-C Simpler\sfix\sfor\sthe\srace\scondition\salso\sfixed\sby\s[7c102c7b5f]
-D 2010-06-09T11:28:44
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+C Shift\sthe\smeaning\sof\saReadMark[]\sback\sso\sthat\s+1\soffset\sfrom\smxFrame\sis\nremoved.\s\sAdd\sthe\snew\sREADMARK_NOT_USED\svalue\s(0xffffffff)\sinstead\sof\nzero\sto\ssignal\san\saReadMark[]\sthat\sis\snot\sin\suse.
+D 2010-06-09T14:45:13
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
-F src/wal.c 70edade3677e36afbe8075d4304cca767848ef6c
+F src/wal.c 25ce19c8e175baf0c7d303243d38c0b2d4b1ba30
F src/wal.h 4ace25262452d17e7d3ec970c89ee17794004008
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
F test/wal.test 0a599c3c4812ed92bc7ad9efcc2c4007fe4cc99a
-F test/wal2.test f70bbe268891a70cc40dce659efe617e548c7491
+F test/wal2.test 854a2b409450f1cb756c2bbd1e87e30740094357
F test/wal3.test ae876ff988af5b2b34d27474e0dd1a8c84e9bbcb
F test/wal_common.tcl 3e953ae60919281688ea73e4d0aa0e1bc94becd9
F test/walbak.test e7650a26eb4b8abeca9b145b1af1e63026dde432
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P b072e9f69ad5ec68b8ec4c716556070001f885e0
-R 9421e982987c37bd229515e5e78a5b85
-U dan
-Z 5d192ec04bfd1c32160d5fae6852d7c2
+P 3c2de820034e01c2e939bd90a05a58159f60df50
+R 91636215da20a362ea2e64fc78c9decc
+U drh
+Z 48ecf6d24ad1746c8fc1cd67f013e730
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFMD6j8oxKgR168RlERAhEQAJ9R5n1TsaleiaYrC7/BGXipfEEX+wCeIl+J
+u01EHGRvmB2pUOkEor+I24I=
+=iubS
+-----END PGP SIGNATURE-----
**
** There is one entry in aReadMark[] for each reader lock. If a reader
** holds read-lock K, then the value in aReadMark[K] is no greater than
-** the mxFrame for that reader. aReadMark[0] is a special case. It
-** always holds zero. Readers holding WAL_READ_LOCK(0) always ignore
-** the entire WAL and read all content directly from the database.
+** the mxFrame for that reader. The value READMARK_NOT_USED (0xffffffff)
+** for any aReadMark[] means that entry is unused. aReadMark[0] is
+** a special case; its value is never used and it exists as a place-holder
+** to avoid having to offset aReadMark[] indexs by one. Readers holding
+** WAL_READ_LOCK(0) always ignore the entire WAL and read all content
+** directly from the database.
**
** The value of aReadMark[K] may only be changed by a thread that
** is holding an exclusive lock on WAL_READ_LOCK(K). Thus, the value of
u32 nBackfill; /* Number of WAL frames backfilled into DB */
u32 aReadMark[WAL_NREADER]; /* Reader marks */
};
+#define READMARK_NOT_USED 0xffffffff
/* A block of WALINDEX_LOCK_RESERVED bytes beginning at
rc = walIndexRemap(pWal, walMappingSize(1));
}
if( rc==SQLITE_OK ){
+ volatile WalCkptInfo *pInfo;
+ int i;
pWal->hdr.aFrameCksum[0] = aFrameCksum[0];
pWal->hdr.aFrameCksum[1] = aFrameCksum[1];
walIndexWriteHdr(pWal);
- /* Zero the checkpoint-header. This is safe because this thread is
+ /* Reset the checkpoint-header. This is safe because this thread is
** currently holding locks that exclude all other readers, writers and
** checkpointers.
*/
- memset((void *)walCkptInfo(pWal), 0, sizeof(WalCkptInfo));
+ pInfo = walCkptInfo(pWal);
+ pInfo->nBackfill = 0;
+ pInfo->aReadMark[0] = 0;
+ for(i=1; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
}
recovery_error:
assert( pInfo==walCkptInfo(pWal) );
for(i=1; i<WAL_NREADER; i++){
u32 y = pInfo->aReadMark[i];
- if( y>0 && mxSafeFrame>=y ){
+ if( mxSafeFrame>=y ){
assert( y<=pWal->hdr.mxFrame );
rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1);
if( rc==SQLITE_OK ){
- pInfo->aReadMark[i] = 0;
+ pInfo->aReadMark[i] = READMARK_NOT_USED;
walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
}else if( rc==SQLITE_BUSY ){
- mxSafeFrame = y-1;
+ mxSafeFrame = y;
}else{
goto walcheckpoint_out;
}
mxI = 0;
for(i=1; i<WAL_NREADER; i++){
u32 thisMark = pInfo->aReadMark[i];
- if( mxReadMark<thisMark && thisMark<=(pWal->hdr.mxFrame+1) ){
+ if( mxReadMark<=thisMark && thisMark<=pWal->hdr.mxFrame ){
+ assert( thisMark!=READMARK_NOT_USED );
mxReadMark = thisMark;
mxI = i;
}
*/
rc = walLockExclusive(pWal, WAL_READ_LOCK(1), 1);
if( rc==SQLITE_OK ){
- pInfo->aReadMark[1] = pWal->hdr.mxFrame+1;
+ pInfo->aReadMark[1] = pWal->hdr.mxFrame;
walUnlockExclusive(pWal, WAL_READ_LOCK(1), 1);
rc = WAL_RETRY;
}else if( rc==SQLITE_BUSY ){
for(i=1; i<WAL_NREADER; i++){
rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1);
if( rc==SQLITE_OK ){
- mxReadMark = pInfo->aReadMark[i] = pWal->hdr.mxFrame+1;
+ mxReadMark = pInfo->aReadMark[i] = pWal->hdr.mxFrame;
mxI = i;
walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
break;
walUnlockShared(pWal, WAL_READ_LOCK(mxI));
return WAL_RETRY;
}else{
- assert( mxReadMark<=(pWal->hdr.mxFrame+1) );
+ assert( mxReadMark<=pWal->hdr.mxFrame );
pWal->readLock = mxI;
}
}