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

If recovery is run before a checkpoint, change back to a CHECKPOINT lock before performing the actual checkpoint.

FossilOrigin-Name: dc98ee169cfa43c89f1b36fb1150d4788710fda3
This commit is contained in:
dan
2010-05-06 18:27:19 +00:00
parent 576bc3294d
commit 5273f58f37
4 changed files with 41 additions and 9 deletions

View File

@@ -919,6 +919,7 @@ int walIndexTryHdr(Wal *pWal, int *pisValid, int *pChanged){
static int walIndexReadHdr(Wal *pWal, int *pChanged){
int rc;
int isValid = 0;
int lockState;
assert( pWal->lockState>=SQLITE_SHM_READ );
assert( pChanged );
@@ -939,6 +940,7 @@ static int walIndexReadHdr(Wal *pWal, int *pChanged){
** file and try again. If the header checksum verification fails this
** time as well, run log recovery.
*/
lockState = pWal->lockState;
if( SQLITE_OK==(rc = walSetLock(pWal, SQLITE_SHM_RECOVER)) ){
/* This call to walIndexTryHdr() may not return an error code, as the
** wal-index is already mapped. It may find that the header is invalid,
@@ -950,7 +952,7 @@ static int walIndexReadHdr(Wal *pWal, int *pChanged){
*pChanged = 1;
rc = walIndexRecover(pWal);
}
walSetLock(pWal, SQLITE_SHM_READ);
walSetLock(pWal, lockState);
}
return rc;