diff options
author | dan <dan@noemail.net> | 2010-05-06 17:28:08 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-05-06 17:28:08 +0000 |
commit | b7d53f54ae81f6d0bc73d887591d57a3ae8f090e (patch) | |
tree | eac30e1cb4c6f3da8128ee9f0645e00fcdc7ce6f /src | |
parent | 6e5b37faef7e7dae22c59a387edbe4709a4820ed (diff) | |
download | sqlite-b7d53f54ae81f6d0bc73d887591d57a3ae8f090e.tar.gz sqlite-b7d53f54ae81f6d0bc73d887591d57a3ae8f090e.zip |
Fix a bug whereby an old snapshot could be checkpointed (and subsequent transactions discarded) if the last connection to disconnect from a WAL database happended to be holding an out-of-date wal-index header.
FossilOrigin-Name: d0c0034b0baa83046c1d6b94c886f7039e4e06f5
Diffstat (limited to 'src')
-rw-r--r-- | src/wal.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -371,6 +371,19 @@ static int walIndexEntry(u32 iFrame){ } /* +** Return the minimum mapping size in bytes that can be used to read the +** wal-index up to and including frame iFrame. If iFrame is the last frame +** in a block of 256 frames, the returned byte-count includes the space +** required by the 256-byte index block. +*/ +static int walMappingSize(u32 iFrame){ + return ( WALINDEX_LOCK_OFFSET + WALINDEX_LOCK_RESERVED + + iFrame*sizeof(u32) + + (iFrame>>8)*256 + ); +} + +/* ** Release our reference to the wal-index memory map, if we are holding ** it. */ @@ -835,7 +848,7 @@ int sqlite3WalClose( */ rc = sqlite3OsLock(pFd, SQLITE_LOCK_EXCLUSIVE); if( rc==SQLITE_OK ){ - rc = walCheckpoint(pWal, pFd, sync_flags, nBuf, zBuf); + rc = sqlite3WalCheckpoint(pWal, pFd, sync_flags, nBuf, zBuf, 0, 0); if( rc==SQLITE_OK ){ isDelete = 1; } |