mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Auto-vacuum bugfix: Do not attempt to move a pointer-map page during auto-vacuum. (CVS 2044)
FossilOrigin-Name: bd50fbb5fecd1829c87e8ca72c458c71f590274b
This commit is contained in:
10
src/btree.c
10
src/btree.c
@@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.200 2004/11/03 03:01:17 danielk1977 Exp $
|
||||
** $Id: btree.c,v 1.201 2004/11/03 03:52:37 danielk1977 Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** For a detailed discussion of BTrees, refer to
|
||||
@@ -1640,6 +1640,9 @@ static int autoVacuumCommit(Btree *pBt){
|
||||
nFreeList = get4byte(&pBt->pPage1->aData[36]);
|
||||
if( nFreeList==0 ) return SQLITE_OK;
|
||||
|
||||
/* TODO: This does not calculate finDbSize correctly for the case where
|
||||
** pointer-map pages must be deallocated.
|
||||
*/
|
||||
origDbSize = sqlite3pager_pagecount(pPager);
|
||||
finDbSize = origDbSize - nFreeList;
|
||||
TRACE(("AUTOVACUUM: Begin (db size %d->%d)\n", origDbSize, finDbSize));
|
||||
@@ -1671,8 +1674,9 @@ static int autoVacuumCommit(Btree *pBt){
|
||||
if( rc!=SQLITE_OK ) goto autovacuum_out;
|
||||
assert( eType!=PTRMAP_ROOTPAGE );
|
||||
|
||||
/* If iDbPage is already on the free-list, do not swap it. */
|
||||
if( eType==PTRMAP_FREEPAGE ){
|
||||
/* If iDbPage is a free or pointer map page, do not swap it. */
|
||||
if( eType==PTRMAP_FREEPAGE ||
|
||||
iDbPage==PTRMAP_PAGENO(pBt->pageSize, iDbPage) ){
|
||||
continue;
|
||||
}
|
||||
rc = getPage(pBt, iDbPage, &pDbMemPage);
|
||||
|
Reference in New Issue
Block a user