1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Merge trunk enhancements into the autovacuum-pages-callback branch.

FossilOrigin-Name: c26c9e5040ef4c52f2a99597e3a7c3eabd52c905d874fc76ca10fd54b749fa97
This commit is contained in:
drh
2021-10-19 18:00:05 +00:00
11 changed files with 300 additions and 32 deletions

View File

@@ -6386,7 +6386,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){
assert( CORRUPT_DB || iPage>1 );
assert( !pMemPage || pMemPage->pgno==iPage );
if( iPage<2 || iPage>pBt->nPage ){
if( NEVER(iPage<2) || iPage>pBt->nPage ){
return SQLITE_CORRUPT_BKPT;
}
if( pMemPage ){
@@ -9576,11 +9576,12 @@ static int clearDatabasePage(
}
rc = getAndInitPage(pBt, pgno, &pPage, 0, 0);
if( rc ) return rc;
if( pPage->bBusy ){
if( (pBt->openFlags & BTREE_SINGLE)==0
&& sqlite3PagerPageRefcount(pPage->pDbPage)!=1
){
rc = SQLITE_CORRUPT_BKPT;
goto cleardatabasepage_out;
}
pPage->bBusy = 1;
hdr = pPage->hdrOffset;
for(i=0; i<pPage->nCell; i++){
pCell = findCell(pPage, i);
@@ -9607,7 +9608,6 @@ static int clearDatabasePage(
}
cleardatabasepage_out:
pPage->bBusy = 0;
releasePage(pPage);
return rc;
}
@@ -9686,10 +9686,10 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
return SQLITE_CORRUPT_BKPT;
}
rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0);
if( rc ) return rc;
rc = sqlite3BtreeClearTable(p, iTable, 0);
if( rc ){
if( rc ) return rc;
rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0);
if( NEVER(rc) ){
releasePage(pPage);
return rc;
}