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

When restarting (wrapping) a log file, set all unused aReadMark[] slots to READMARK_NOT_USED instead of 0. Setting them to 0 does not cause a problem, but may cause SQLite to obtain and release a few more file locks than would otherwise be necessary.

FossilOrigin-Name: 0797b10c0cc08ae38e26685d1f8331e37d428781
This commit is contained in:
dan
2010-06-09 16:58:49 +00:00
parent 6ac4339439
commit 199100e2cd
3 changed files with 11 additions and 8 deletions

View File

@@ -2217,13 +2217,16 @@ static int walRestartLog(Wal *pWal){
** safe and means there is no special case for sqlite3WalUndo()
** to handle if this transaction is rolled back.
*/
int i; /* Loop counter */
u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
pWal->nCkpt++;
pWal->hdr.mxFrame = 0;
sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));
sqlite3_randomness(4, &aSalt[1]);
walIndexWriteHdr(pWal);
memset((void*)pInfo, 0, sizeof(*pInfo));
pInfo->nBackfill = 0;
for(i=1; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
assert( pInfo->aReadMark[0]==0 );
walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
}
}