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

Make the auto_vacuum mode peristent in all cases. (CVS 4115)

FossilOrigin-Name: 5b0408ddd0f1c825f402d0f5a3088a61b5ecd2c3
This commit is contained in:
danielk1977
2007-06-25 08:16:58 +00:00
parent d62e76c792
commit 27b1f95f08
6 changed files with 142 additions and 30 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.390 2007/06/24 10:14:00 danielk1977 Exp $
** $Id: btree.c,v 1.391 2007/06/25 08:16:58 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -1362,12 +1362,10 @@ int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){
#else
BtShared *pBt = p->pBt;
int av = (autoVacuum?1:0);
int iv = (autoVacuum==BTREE_AUTOVACUUM_INCR?1:0);
if( pBt->pageSizeFixed && av!=pBt->autoVacuum ){
return SQLITE_READONLY;
}
pBt->autoVacuum = av;
pBt->incrVacuum = iv;
return SQLITE_OK;
#endif
}
@@ -1436,6 +1434,7 @@ static int lockBtree(BtShared *pBt){
pBt->minLeafFrac = page1[23];
#ifndef SQLITE_OMIT_AUTOVACUUM
pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0);
pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0);
#endif
}
@@ -5679,6 +5678,11 @@ int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){
rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
if( rc ) return rc;
put4byte(&pP1[36 + idx*4], iMeta);
if( idx==7 ){
assert( pBt->autoVacuum || iMeta==0 );
assert( iMeta==0 || iMeta==1 );
pBt->incrVacuum = iMeta;
}
return SQLITE_OK;
}