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

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
This commit is contained in:
drh
2010-05-07 20:34:17 +00:00
parent e874d9ed79
commit 2905f053ef
3 changed files with 16 additions and 11 deletions

View File

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