1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

New checked in PRAGMA integrity_check to validate the autovacuum settings

in the header.

FossilOrigin-Name: a4663f09c91d1381a831f61a2b8e8a113eb6083932c4aea2ad0c011ece1418c5
This commit is contained in:
drh
2018-07-20 15:44:09 +00:00
parent 91d5866eb6
commit 040d77aa71
3 changed files with 25 additions and 7 deletions

View File

@@ -9840,6 +9840,24 @@ char *sqlite3BtreeIntegrityCheck(
/* Check all the tables.
*/
#ifndef SQLITE_OMIT_AUTOVACUUM
if( pBt->autoVacuum ){
int mx = 0;
int mxInHdr;
for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
mxInHdr = get4byte(&pBt->pPage1->aData[52]);
if( mx!=mxInHdr ){
checkAppendMsg(&sCheck,
"max rootpage (%d) disagrees with header (%d)",
mx, mxInHdr
);
}
}else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
checkAppendMsg(&sCheck,
"incremental_vacuum enabled with a max rootpage of zero"
);
}
#endif
testcase( pBt->db->flags & SQLITE_CellSizeCk );
pBt->db->flags &= ~SQLITE_CellSizeCk;
for(i=0; (int)i<nRoot && sCheck.mxErr; i++){