From: drh Date: Fri, 7 May 2010 20:34:17 +0000 (+0000) Subject: When running a checkpoint while in locking_mode=EXCLUSIVE, be sure to move X-Git-Tag: version-3.7.2~395 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2905f053effc873fffdc4faa1a961f2513d04910;p=thirdparty%2Fsqlite.git When running a checkpoint while in locking_mode=EXCLUSIVE, be sure to move the wal-index lock to UNLOCK from READ prior to promoting to CHECKPOINT. FossilOrigin-Name: be114bdf9bb98c7287f8cb54340c630b0c412e9d --- diff --git a/manifest b/manifest index 7af380648e..81acdf4335 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Change\sthe\sxShmOpen()\smethod\sof\sthe\sVFS\sto\stake\sthe\sdatabase\sfile\sname\sas\nits\sargument,\snot\sthe\sWAL\sfile\sname.\s\sAlso\sfix\ssome\sunrelated\scompiler\nwarnings. -D 2010-05-07T20:02:24 +C When\srunning\sa\scheckpoint\swhile\sin\slocking_mode=EXCLUSIVE,\sbe\ssure\sto\smove\nthe\swal-index\slock\sto\sUNLOCK\sfrom\sREAD\sprior\sto\spromoting\sto\sCHECKPOINT. +D 2010-05-07T20:34:17 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 6704aa53295073e590f3d802acec9722df671cd8 +F src/wal.c 66147e8b8623050a970ac9ba64688b95eb4e3bc3 F src/wal.h b4c42014b5fa3b4e6244ac8c65de7ff67adeb27c F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356 @@ -816,14 +816,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P e1230782a371f09cd46dacc8ecbc6a0c5baab2d5 -R 34103b151852b68b8447281dee8b52f5 +P a65c2939267ef6acec4e355a207f98f217e263d6 +R a46357f982ebdd4520842ec1c873b4c4 U drh -Z 09fd161899845c827ac24875d31a8565 +Z 46431e902a37a907f9e07e8180abbf8b -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFL5HHToxKgR168RlERAruYAJ0VKELfyDrHdFSidCXg6pDgk6NVIgCfW0O4 -0ozplsGsZxT6V2WCirZEVVU= -=fGE6 +iD8DBQFL5HlMoxKgR168RlERAnrAAKCMJ4zxVnnT86OHLDJpyko7/j+9/QCgjflR +YUDucsN2KcpF/NWFDOXGwZ8= +=xUef -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index ef38a5f106..92fe02cdb3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a65c2939267ef6acec4e355a207f98f217e263d6 \ No newline at end of file +be114bdf9bb98c7287f8cb54340c630b0c412e9d \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index 81f63504c1..575d8b46b7 100644 --- a/src/wal.c +++ b/src/wal.c @@ -1349,10 +1349,15 @@ int sqlite3WalCheckpoint( int rc; /* Return code */ int isChanged = 0; /* True if a new wal-index header is loaded */ - assert( pWal->lockState==SQLITE_SHM_UNLOCK ); assert( pWal->pWiData==0 ); /* Get the CHECKPOINT lock */ + if( pWal->lockState!=SQLITE_SHM_UNLOCK ){ + /* This can occur when locking_mode=EXCLUSIVE */ + assert( pWal->lockState==SQLITE_SHM_READ + || pWal->lockState==SQLITE_SHM_READ_FULL ); + walSetLock(pWal, SQLITE_SHM_UNLOCK); + } do { rc = walSetLock(pWal, SQLITE_SHM_CHECKPOINT); }while( rc==SQLITE_BUSY && xBusyHandler(pBusyHandlerArg) );