System.Data.SQLite
Check-in [81b6f97b42]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add garbage collection workload to the stress test and centralize the garbage collection logic in the test suite infrastructure.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 81b6f97b420e8743abb85a72240478abf5f53ae7
User & Date: mistachkin 2012-10-07 02:04:38
Context
2012-10-07
03:41
Update Eagle in externals to the latest trunk. Always specify the stack size for threads created by the test suite. Allow the SQLite temporary directory used by the test suite to be easily overridden. check-in: bed252ba0c user: mistachkin tags: trunk
02:04
Add garbage collection workload to the stress test and centralize the garbage collection logic in the test suite infrastructure. check-in: 81b6f97b42 user: mistachkin tags: trunk
2012-10-06
23:57
Update the master release archive manifest. check-in: a2cb6af104 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/common.eagle.

807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
...
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
...
939
940
941
942
943
944
945












946
947
948
949
950
951
952
...
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
    proc cleanupDb { fileName {varName db} {collect true} {qualify true}
                     {delete true} } {
      #
      # NOTE: Attempt to force all pending "garbage" objects to be collected,
      #       including SQLite statements and backup objects; this should allow
      #       the underlying database file to be deleted.
      #
      if {$collect && \
          [catch {object invoke GC GetTotalMemory true} error]} then {
        tputs $channel [appendArgs \
            "==== WARNING: failed full garbage collection, error: " \
            \n\t $error \n]
      }

      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of our
      #       caller.  The handle to the database previously opened by [setupDb]
      #       should be stored there.
      #
................................................................................
 
    proc cleanupFile { fileName {collect true} {force false} } {
      #
      # NOTE: Attempt to force all pending "garbage" objects to be collected,
      #       including SQLite statements and backup objects; this should allow
      #       the underlying database file to be deleted.
      #
      if {$collect && \
          [catch {object invoke GC GetTotalMemory true} error]} then {
        tputs $channel [appendArgs \
            "==== WARNING: failed full garbage collection, error: " \
            \n\t $error \n]
      }

      #
      # NOTE: Check if the file still exists.
      #
      if {[file exists $fileName]} then {
        #
................................................................................
        # NOTE: The file does not exist, success!
        #
        set code 0
      }

      return $code
    }












 
    proc reportSQLiteResources { channel {quiet false} {collect true} } {
      #
      # NOTE: Skip all output if we are running in "quiet" mode.
      #
      if {!$quiet} then {
        tputs $channel "---- current memory in use by SQLite... "
................................................................................

        if {!$quiet} then {
          tputs $channel [appendArgs $memory \n]
        }
      }

      if {$collect} then {
        if {[catch {object invoke GC GetTotalMemory true} error]} then {
          tputs $channel [appendArgs \
              "==== WARNING: failed full garbage collection, error: " \
              \n\t $error \n]
        }
      }

      if {!$quiet} then {
        tputs $channel "---- current memory in use by the CLR... "
      }

      if {[catch {object invoke GC GetTotalMemory false} memory] == 0} then {







|
|
<
<
<







 







|
|
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>







 







|
<
<
<
<







807
808
809
810
811
812
813
814
815



816
817
818
819
820
821
822
...
890
891
892
893
894
895
896
897
898



899
900
901
902
903
904
905
...
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
...
995
996
997
998
999
1000
1001
1002




1003
1004
1005
1006
1007
1008
1009
    proc cleanupDb { fileName {varName db} {collect true} {qualify true}
                     {delete true} } {
      #
      # NOTE: Attempt to force all pending "garbage" objects to be collected,
      #       including SQLite statements and backup objects; this should allow
      #       the underlying database file to be deleted.
      #
      if {$collect} then {
        collectGarbage $::test_channel



      }

      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of our
      #       caller.  The handle to the database previously opened by [setupDb]
      #       should be stored there.
      #
................................................................................
 
    proc cleanupFile { fileName {collect true} {force false} } {
      #
      # NOTE: Attempt to force all pending "garbage" objects to be collected,
      #       including SQLite statements and backup objects; this should allow
      #       the underlying database file to be deleted.
      #
      if {$collect} then {
        collectGarbage $::test_channel



      }

      #
      # NOTE: Check if the file still exists.
      #
      if {[file exists $fileName]} then {
        #
................................................................................
        # NOTE: The file does not exist, success!
        #
        set code 0
      }

      return $code
    }
 
    proc collectGarbage { channel } {
      #
      # NOTE: Attempt to force a full garbage collection now.  Report any
      #       error that is encountered if we fail.
      #
      if {[catch {object invoke GC GetTotalMemory true} error]} then {
        tputs $channel [appendArgs \
            "==== WARNING: failed full garbage collection, error: " \
            \n\t $error \n]
      }
    }
 
    proc reportSQLiteResources { channel {quiet false} {collect true} } {
      #
      # NOTE: Skip all output if we are running in "quiet" mode.
      #
      if {!$quiet} then {
        tputs $channel "---- current memory in use by SQLite... "
................................................................................

        if {!$quiet} then {
          tputs $channel [appendArgs $memory \n]
        }
      }

      if {$collect} then {
        collectGarbage $channel




      }

      if {!$quiet} then {
        tputs $channel "---- current memory in use by the CLR... "
      }

      if {[catch {object invoke GC GetTotalMemory false} memory] == 0} then {

Changes to Tests/stress.eagle.

533
534
535
536
537
538
539






















540
541
542
543
544
545
546
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]






















} -body {
  for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} {
    sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"

    unset -nocomplain thread

    foreach index(1) [lsort -integer [array names workload]] {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(15) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #15, force managed garbage collection
    #
    lappend ::times(15) [lindex [time {
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          collectGarbage $::test_channel
          showTest F
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
    }] 0]
  }]
} -body {
  for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} {
    sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"

    unset -nocomplain thread

    foreach index(1) [lsort -integer [array names workload]] {

Changes to Tests/tkt-996d13cd87.eagle.

272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
        } result] : [set result ""]}] $result [getPoolCounts] \
        [expr {$havePoolCounts ? $pooling ? $poolCounts(opened) > 0 : \
            $poolCounts(opened) == 0} : True] \
        [expr {$havePoolCounts ? $pooling ? $poolCounts(closed) > 0 : \
            $poolCounts(closed) == 0} : True]
  } -cleanup {
    object invoke System.Data.SQLite.SQLiteConnection ClearAllPools
    object invoke GC GetTotalMemory true

    cleanupDb $fileName

    unset -nocomplain result results errors code sql dataSource id db \
        poolCounts havePoolCounts fileName

    rename getPoolCounts ""







|







272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
        } result] : [set result ""]}] $result [getPoolCounts] \
        [expr {$havePoolCounts ? $pooling ? $poolCounts(opened) > 0 : \
            $poolCounts(opened) == 0} : True] \
        [expr {$havePoolCounts ? $pooling ? $poolCounts(closed) > 0 : \
            $poolCounts(closed) == 0} : True]
  } -cleanup {
    object invoke System.Data.SQLite.SQLiteConnection ClearAllPools
    collectGarbage $test_channel

    cleanupDb $fileName

    unset -nocomplain result results errors code sql dataSource id db \
        poolCounts havePoolCounts fileName

    rename getPoolCounts ""