1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Make wal_checkpoint a no-op if a prior checkpoint has already copied all

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
This commit is contained in:
drh
2010-12-16 02:06:29 +00:00
parent d9c9b78e6c
commit 7d20844542
3 changed files with 12 additions and 12 deletions

View File

@@ -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 ){