diff options
author | dan <dan@noemail.net> | 2010-06-05 14:42:57 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-06-05 14:42:57 +0000 |
commit | 0626bd65fb67288201b738a38ad73bba3e8fe341 (patch) | |
tree | 9478f017da1ed5bb447a825baf89c736eed7c542 /src/wal.c | |
parent | ef4ee8f274e328be29441e23588a94cc343a037f (diff) | |
download | sqlite-0626bd65fb67288201b738a38ad73bba3e8fe341.tar.gz sqlite-0626bd65fb67288201b738a38ad73bba3e8fe341.zip |
Mark a condition in wal.c as ALWAYS().
FossilOrigin-Name: 3fe0cc784ac586358c08f87fba458dfbb5eec6f2
Diffstat (limited to 'src/wal.c')
-rw-r--r-- | src/wal.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -2085,8 +2085,23 @@ int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx){ rc = walIndexMap(pWal, walMappingSize(iMax)); } if( rc==SQLITE_OK ){ - for(iFrame=pWal->hdr.mxFrame+1; rc==SQLITE_OK && iFrame<=iMax; iFrame++){ + for(iFrame=pWal->hdr.mxFrame+1; + ALWAYS(rc==SQLITE_OK) && iFrame<=iMax; + iFrame++ + ){ + /* This call cannot fail. Unless the page for which the page number + ** is passed as the second argument is (a) in the cache and + ** (b) has an outstanding reference, then xUndo is either a no-op + ** (if (a) is false) or simply expels the page from the cache (if (b) + ** is false). + ** + ** If the upper layer is doing a rollback, it is guaranteed that there + ** are no outstanding references to any page other than page 1. And + ** page 1 is never written to the log until the transaction is + ** committed. As a result, the call to xUndo may not fail. + */ assert( pWal->writeLock ); + assert( pWal->pWiData[walIndexEntry(iFrame)]!=1 ); rc = xUndo(pUndoCtx, pWal->pWiData[walIndexEntry(iFrame)]); } walCleanupHash(pWal); |