]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Make wal_checkpoint a no-op if a prior checkpoint has already copied all
authordrh <drh@noemail.net>
Thu, 16 Dec 2010 02:06:29 +0000 (02:06 +0000)
committerdrh <drh@noemail.net>
Thu, 16 Dec 2010 02:06:29 +0000 (02:06 +0000)
WAL content into the database.  This prevents a concurrent write to the
database from resetting the wal-index out from under the WalIterator of
the checkpoint as it is initializing.

FossilOrigin-Name: cf86affcb7d3089496e9849cbf43a211097e4f64

manifest
manifest.uuid
src/wal.c

index b15c5901aab5635ce34081cb443a93ac933ce2ce..5130ec956c27b696c68aaac7235bddec1a60488a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Enhanced\scomments\sin\swal.c\sand\sdeclare\ssome\sprocedure\sparameters\s"const".\nNo\schanges\sto\sthe\sgenerated\scode.
-D 2010-12-15T21:02:06
+C Make\swal_checkpoint\sa\sno-op\sif\sa\sprior\scheckpoint\shas\salready\scopied\sall\s\nWAL\scontent\sinto\sthe\sdatabase.\s\sThis\sprevents\sa\sconcurrent\swrite\sto\sthe\ndatabase\sfrom\sresetting\sthe\swal-index\sout\sfrom\sunder\sthe\sWalIterator\sof\nthe\scheckpoint\sas\sit\sis\sinitializing.
+D 2010-12-16T02:06:30
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 4547616ad2286053af6ccccefa242dc925e49bf0
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -240,7 +240,7 @@ F src/vdbeblob.c 18955f0ee6b133cd08e1592010cb9a6b11e9984c
 F src/vdbemem.c 411649a35686f54268ccabeda175322c4697f5a6
 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
 F src/vtab.c b297e8fa656ab5e66244ab15680d68db0adbec30
-F src/wal.c 1c846e56cb271675304c0152cea91f4c2ecf5111
+F src/wal.c dbca424f71678f663a286ab2a98f947af1d412a7
 F src/wal.h c1aac6593a0b02b15dc625987e619edeab39292e
 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
 F src/where.c fa22d45b2577c77146f2e894d58011d472d64103
@@ -897,14 +897,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P e1660764f20fed3fe92156d2b7f06075ff6ac145
-R 1109917c271937e015845cf31d3c184d
+P d0e4375b8a784d4e4ae66caababac919edd61883
+R 80db019f1fe0898e29ee135039b02e42
 U drh
-Z 64f2fa76dd6cb11cf7eb68fbbec80d5e
+Z b7c01cb05c8175ac2d3c285f2b41993d
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFNCSzRoxKgR168RlERAuCpAJ9yUwv8k5HtKXw8KEgKm4OKZcQUiwCfRCV0
-zLsoQIm1ng13QYFi6EqUsyY=
-=j104
+iD8DBQFNCXQpoxKgR168RlERAvhYAJ9VEC5cEqFcvoO8pUyjLqrkEx8osgCePOvl
+dryfAhOPr5nP5lktpU/6FWo=
+=UvbB
 -----END PGP SIGNATURE-----
index 72d8e84c22dc2272a7e11245dd553efb7e6ad4e3..e14e6337292a199edf4ef467436a1ef00faa3bde 100644 (file)
@@ -1 +1 @@
-d0e4375b8a784d4e4ae66caababac919edd61883
\ No newline at end of file
+cf86affcb7d3089496e9849cbf43a211097e4f64
\ No newline at end of file
index 913644c4ae8dfc99e7b9348b5f5b52f50c8d6d70..ff327bf6bb5a30147beab40fa3aa81f765b05f3d 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -1608,7 +1608,8 @@ static int walCheckpoint(
   szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
   testcase( szPage<=32768 );
   testcase( szPage>=65536 );
-  if( pWal->hdr.mxFrame==0 ) return SQLITE_OK;
+  pInfo = walCkptInfo(pWal);
+  if( pInfo->nBackfill>=pWal->hdr.mxFrame ) return SQLITE_OK;
 
   /* Allocate the iterator */
   rc = walIteratorInit(pWal, &pIter);
@@ -1630,7 +1631,6 @@ static int walCheckpoint(
   */
   mxSafeFrame = pWal->hdr.mxFrame;
   mxPage = pWal->hdr.nPage;
-  pInfo = walCkptInfo(pWal);
   for(i=1; i<WAL_NREADER; i++){
     u32 y = pInfo->aReadMark[i];
     if( mxSafeFrame>=y ){