]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Do not fail a checkpoint just because active readers prevent backfill.
authordrh <drh@noemail.net>
Mon, 31 May 2010 12:30:52 +0000 (12:30 +0000)
committerdrh <drh@noemail.net>
Mon, 31 May 2010 12:30:52 +0000 (12:30 +0000)
FossilOrigin-Name: 9aa4243e0cedcc9204994d04af1b2b7a80c048bd

manifest
manifest.uuid
src/wal.c
test/wal.test

index 96c29da34006f874d27c4738bbea786752bcc013..48d287f576ab6e568ffcd6aa60af6eaee6e00cc9 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Add\sWALTRACE()\smacros\sto\shelp\swith\sdebugging\sand\sanalysis.
-D 2010-05-31T12:15:19
+C Do\snot\sfail\sa\scheckpoint\sjust\sbecause\sactive\sreaders\sprevent\sbackfill.
+D 2010-05-31T12:30:52
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -227,7 +227,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
 F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
-F src/wal.c 880542c13b78c8c3480a1ca85c4893e01164392d
+F src/wal.c 0b3cf78459540fc9504cc5c6670d656e95d6f48a
 F src/wal.h 1c1c9feb629b7f4afcbe0b47f80f47c5551d3a02
 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
 F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
@@ -764,7 +764,7 @@ F test/vtabE.test 7c4693638d7797ce2eda17af74292b97e705cc61
 F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
 F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
-F test/wal.test be8ef043253ca735ffcabb92a7dac2d79ebfe8c1
+F test/wal.test b965dc2509515a7758016cbec398ea4b1ff5424a
 F test/wal2.test c58bb5b2fac48b8393909038ced730df5ad973b0
 F test/walbak.test e7650a26eb4b8abeca9b145b1af1e63026dde432
 F test/walcksum.test 4efa8fb88c32bed8288ea4385a9cc113a5c8f0bf
@@ -818,14 +818,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 853f1e3f7720af2723b552bdf086bb106e6e93fe
-R 120f65861720c5d4229e92e8bd223686
+P 765c33181a7b9d99b452ce750d69f217b3c81a5d
+R 1e19bec8e3b7c1b6a9925e13022fc48f
 U drh
-Z 5164efe54d9bd042fe1bad6aa9fe9dc9
+Z c22021b716c64e3ce3cd89536f71c5b9
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFMA6haoxKgR168RlERAtHPAJ413tpB3ORA2MgPN4oQbrLuYBHg0wCfaWeG
-n630VhFDz8zIhJw1pFxWTdU=
-=JKTG
+iD8DBQFMA6wAoxKgR168RlERAqR7AJ9WJJ/VHv5q/R1C70ZExZQHh/d9XQCfVqlC
+ZdxZW50cpNVzLpKcKSRyJHU=
+=weXO
 -----END PGP SIGNATURE-----
index a11ecdb00161a5cc729e1f9eac8fea3ba2d83c02..1bd46b4f0d0733ed7dfa8f491300dcb6d481b1c7 100644 (file)
@@ -1 +1 @@
-765c33181a7b9d99b452ce750d69f217b3c81a5d
\ No newline at end of file
+9aa4243e0cedcc9204994d04af1b2b7a80c048bd
\ No newline at end of file
index 11ad7949ae50e36487515248e5d741959b5da5fa..42870058863db280692f8cddce2c8f9c1af94a09 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -1445,6 +1445,11 @@ static int walCheckpoint(
 
     /* Release the reader lock held while backfilling */
     walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);
+  }else{
+    /* Reset the return code so as not to report a checkpoint failure
+    ** just because active readers prevent any backfill.
+    */
+    rc = SQLITE_OK;
   }
 
   walIteratorFree(pIter);
index fbe0bd3ee7a3f07194a68c57a9aec90f6be9c4be..27a9a7b17d0e3a13a562f69d1418183883d0ca3d 100644 (file)
@@ -571,26 +571,17 @@ foreach code [list {
   } {1 2 3 4 5 6 7 8 9 10}
   do_test wal-10.$tn.12 {
     catchsql { PRAGMA wal_checkpoint } 
-  } {1 {database is locked}}
+  } {0 {}}   ;# Reader no longer block checkpoints
   do_test wal-10.$tn.13 {
     execsql { INSERT INTO t1 VALUES(11, 12) }
     sql2 {SELECT * FROM t1}
   } {1 2 3 4 5 6 7 8 9 10}
 
-  # Connection [db2] is holding a lock on a snapshot, preventing [db] from
-  # checkpointing the database. Add a busy-handler to [db]. If [db2] completes
-  # its transaction from within the busy-handler, [db] is able to complete
-  # the checkpoint operation.
+  # Writers do not block checkpoints any more either.
   #
-  proc busyhandler x {
-    if {$x==4} { sql2 COMMIT }
-    if {$x<5} { return 0 }
-    return 1
-  }
-  db busy busyhandler
   do_test wal-10.$tn.14 {
-    execsql { PRAGMA wal_checkpoint } 
-  } {}
+    catchsql { PRAGMA wal_checkpoint } 
+  } {0 {}}
 
   # Similar to the test above. Except this time, a new read transaction is
   # started (db3) while the checkpointer is waiting for an old one (db2) to 
@@ -598,9 +589,8 @@ foreach code [list {
   # must wait until after db3 has closed the read transaction, as db3 is a
   # "region D" writer.
   #
-  db busy {}
   do_test wal-10.$tn.15 {
-    sql2 { BEGIN; SELECT * FROM t1; }
+    sql2 { COMMIT; BEGIN; SELECT * FROM t1; }
   } {1 2 3 4 5 6 7 8 9 10 11 12}
   do_test wal-10.$tn.16 {
     catchsql { PRAGMA wal_checkpoint }