diff options
author | dan <dan@noemail.net> | 2010-07-15 17:54:14 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-07-15 17:54:14 +0000 |
commit | 7d4514a4e16322182a06b2e4e24fc6cd639cff79 (patch) | |
tree | f51b96fa665243b9724663824a8bd10a0c7427db /src/wal.c | |
parent | c74e4ef4c7be9e8d4dd928227e805b2d5d4f1569 (diff) | |
download | sqlite-7d4514a4e16322182a06b2e4e24fc6cd639cff79.tar.gz sqlite-7d4514a4e16322182a06b2e4e24fc6cd639cff79.zip |
Handle the case where xShmMap returns SQLITE_BUSY.
FossilOrigin-Name: 75f5354876c4300a8e53fe551dc837dd383d1e38
Diffstat (limited to 'src/wal.c')
-rw-r--r-- | src/wal.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1866,8 +1866,16 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ ** WAL_RETRY this routine will be called again and will probably be ** right on the second iteration. */ - rc = walLockShared(pWal, WAL_RECOVER_LOCK); - if( rc==SQLITE_OK ){ + if( pWal->apWiData[0]==0 ){ + /* This branch is taken when the xShmMap() method returns SQLITE_BUSY. + ** We assume this is a transient condition, so return WAL_RETRY. The + ** xShmMap() implementation used by the default unix and win32 VFS + ** modules may return SQLITE_BUSY due to a race condition in the + ** code that determines whether or not the shared-memory region + ** must be zeroed before the requested page is returned. + */ + rc = WAL_RETRY; + }else if( SQLITE_OK==(rc = walLockShared(pWal, WAL_RECOVER_LOCK)) ){ walUnlockShared(pWal, WAL_RECOVER_LOCK); rc = WAL_RETRY; }else if( rc==SQLITE_BUSY ){ |