]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fixes to tcl test files so that they work in auto-vacuum mode.
authordan <dan@noemail.net>
Wed, 11 Aug 2010 11:35:50 +0000 (11:35 +0000)
committerdan <dan@noemail.net>
Wed, 11 Aug 2010 11:35:50 +0000 (11:35 +0000)
FossilOrigin-Name: ea9eaf7480f6fbe2a37813508d1b730d45155966

manifest
manifest.uuid
test/dbstatus.test
test/ioerr5.test

index 7c0d197a066d8a47581f86199bbf330047547cb8..cfad7470960a421414dcb26e037bd4c69956d269 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\smemory\sallocation\sin\sproxy\slocking\sso\sthat\sit\sworks\swith\sSQLITE_MEMDEBUG.
-D 2010-08-11T06:14:16
+C Fixes\sto\stcl\stest\sfiles\sso\sthat\sthey\swork\sin\sauto-vacuum\smode.
+D 2010-08-11T11:35:50
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -330,7 +330,7 @@ F test/createtab.test 199cf68f44e5d9e87a0b8afc7130fdeb4def3272
 F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
 F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
 F test/date.test 6354b883f922c38046a8efbad187cc95df6da023
-F test/dbstatus.test ba072efbd7fcbeb4da324bfbdf1e596d994c159e
+F test/dbstatus.test 946e1399d4574fc5dac934cceedbc76924af3f5a
 F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc
 F test/delete.test f7629d9eb245dfca170169cc5c7a735dec34aeb4
 F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa
@@ -461,7 +461,7 @@ F test/ioerr.test 390785ec65f10aa58a82b048ee12e9052d783fa8
 F test/ioerr2.test 1b56cb80d5b0726ee3ba325ca175734541e32955
 F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
 F test/ioerr4.test fc6eddfec2efc2f1ed217b9eae4c1c1d3516ce86
-F test/ioerr5.test 89f69b09a6b5d4f5bbfe58d4231f28236d842dcb
+F test/ioerr5.test a5e04b7a590f262c4100ba0b277387889802672b
 F test/join.test 8d63cc4d230a7affafa4b6ab0b97c49b8ccb365c
 F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324
 F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
@@ -843,7 +843,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P aa092ac928dc19bd356d25a1dfd3f432dc145ce6
-R 0eec45cd382afd1ba34bd6e2246aabd9
-U drh
-Z c435d17ee732eeb430792e4998e9f07c
+P f854cbe06355dd3455b8af4ad6366949c412434e
+R 8100cf013cafb385b45c46a7946d4b51
+U dan
+Z 0cb971a0eede9ee7180d74e425f8b9d8
index bfca4e5c0f859494598d2143f4ba743192ddb04b..b23ed1d6d22c663ca96299e029642dbabbbe4ab1 100644 (file)
@@ -1 +1 @@
-f854cbe06355dd3455b8af4ad6366949c412434e
\ No newline at end of file
+ea9eaf7480f6fbe2a37813508d1b730d45155966
\ No newline at end of file
index 53d3d66f0a0cc92fcfafe5e4158e36c07ce5eaf6..5cb87015e40e07b29d789484017b4b1b585e773b 100644 (file)
@@ -182,12 +182,16 @@ foreach ::lookaside_buffer_size {0 64 120} {
     set nFree [expr {$nAlloc1-$nAlloc2}]
     
     # Tests for which the test name ends in an "x" report slightly less
-    # memory than is actually freed when all statements are finalized.
-    # This is because a small amount of memory allocated by a virtual table
-    # implementation using sqlite3_mprintf() is technically considered
-    # external and so is not counted as "statement memory".
+    # memory than is actually freed when all schema items are finalized.
+    # This is because memory allocated by virtual table implementations
+    # for any reason is not counted as "schema memory".
     #
-    if {[string match *x $tn]} {
+    # Additionally, in auto-vacuum mode, dropping tables and indexes causes
+    # the page-cache to shrink. So the amount of memory freed is always
+    # much greater than just that reported by DBSTATUS_SCHEMA_USED in this
+    # case.
+    #
+    if {[string match *x $tn] || $AUTOVACUUM} {
       do_test dbstatus-2.$tn.ax { expr {($nSchema1-$nSchema2)<=$nFree} } 1
     } else {
       do_test dbstatus-2.$tn.a { expr {$nSchema1-$nSchema2} } $nFree
@@ -323,7 +327,7 @@ foreach ::lookaside_buffer_size {0 64 120} {
     # implementation using sqlite3_mprintf() is technically considered
     # external and so is not counted as "statement memory".
     #
-puts "$nStmt1 $nFree"
+#puts "$nStmt1 $nFree"
     if {[string match *x $tn]} {
       do_test dbstatus-3.$tn.bx { expr $nStmt1<=$nFree }  {1}
     } else {
index 6e9014539f1c00385a0410a627c7ded6838bbf7a..74fe10412381430e02a75854c7f59afe7ddb5aa7 100644 (file)
@@ -91,6 +91,15 @@ foreach locking_mode {normal exclusive} {
         INSERT INTO a VALUES(1, 'ABCDEFGHIJKLMNOP');
       }
     } {}
+
+    # Open a read-only cursor on table "a". If the COMMIT below is
+    # interrupted by a persistent IO error, the pager will transition to 
+    # PAGER_ERROR state. If there are no other read-only cursors open,
+    # from there the pager immediately discards all cached data and 
+    # switches to PAGER_OPEN state. This read-only cursor stops that
+    # from happening, leaving the pager stuck in PAGER_ERROR state.
+    #
+    set channel [db incrblob -readonly a Name [db last_insert_rowid]]
   
     # Now try to commit the transaction. Cause an IO error to occur
     # within this operation, which moves the pager into the error state.
@@ -118,25 +127,11 @@ foreach locking_mode {normal exclusive} {
     # with the dirty page.
     #
     do_test ioerr5-1.$locking_mode-$iFail.3 {
-      set bt [btree_from_db db]
       sqlite3_soft_heap_limit 1024
       compilesql16 "SELECT 10"
-      array set stats [btree_pager_stats $bt]
-
-      # If the pager made it all the way to PAGER_SYNCED state, then 
-      # both in-memory pages are clean. Following the calls to 
-      # release_memory() that were made as part of the [compilesql16]
-      # above, there will be zero pages left in the cache.
-      #
-      # If the pager did not make it as far as PAGER_SYNCED, the two
-      # in memory pages are still dirty. So there will be 2 pages left
-      # in the cache following the release_memory() calls.
-      #
-      if {$stats(state)==5} {
-        set nPage 0
-      }
-      expr {$stats(page)==$nPage}
-    } {1}
+    } {}
+
+    close $channel
 
     # Ensure that nothing was written to the database while reclaiming
     # memory from the pager in error state.
@@ -148,7 +143,7 @@ foreach locking_mode {normal exclusive} {
       close $fd
       expr {$zDatabase eq $zDatabase2}
     } {1}
-  
+
     if {$rc eq [list 0 {}]} {
       do_test ioerr5.1-$locking_mode-$iFail.3 {
         execsql { SELECT count(*) FROM a }