aboutsummaryrefslogtreecommitdiff
path: root/src/wal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wal.c')
-rw-r--r--src/wal.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wal.c b/src/wal.c
index 49becd0e0..48b9c04b5 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -822,11 +822,16 @@ static void walCleanupHash(Wal *pWal){
int iLimit; /* Zero values greater than this */
assert( pWal->writeLock );
- walHashFind(pWal, pWal->hdr.mxFrame+1, &aHash, &aPgno, &iZero);
- iLimit = pWal->hdr.mxFrame - iZero;
- if( iLimit>0 ){
+ testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE-1 );
+ testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE );
+ testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE+1 );
+ if( (pWal->hdr.mxFrame % HASHTABLE_NPAGE)>0 ){
int nByte; /* Number of bytes to zero in aPgno[] */
int i; /* Used to iterate through aHash[] */
+
+ walHashFind(pWal, pWal->hdr.mxFrame+1, &aHash, &aPgno, &iZero);
+ iLimit = pWal->hdr.mxFrame - iZero;
+ assert( iLimit>0 );
for(i=0; i<HASHTABLE_NSLOT; i++){
if( aHash[i]>iLimit ){
aHash[i] = 0;