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

Bug fix in the computation of the number of pages to autovacuum when

nReserve is greater than zero. (CVS 6880)

FossilOrigin-Name: 618a83d65f973183d21245721dc656a35ff594a4
This commit is contained in:
drh
2009-07-11 17:04:08 +00:00
parent a4ec1d443a
commit 41d628c123
3 changed files with 17 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
C Unwind\ssome\scomplex\sconditions\sin\ssqlite3BtreeDelete()\sinto\nseparate\s"if"\sstatements.\s(CVS\s6879)
D 2009-07-11T13:13:12
C Bug\sfix\sin\sthe\scomputation\sof\sthe\snumber\sof\spages\sto\sautovacuum\swhen\nnReserve\sis\sgreater\sthan\szero.\s(CVS\s6880)
D 2009-07-11T17:04:09
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
F src/btree.c a080b574ea4b07df9deca83e0e38e8f08015a0ac
F src/btree.c 6a5d08b45a7850fde2deec76254ca6a3c1ad7ffc
F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
F src/btreeInt.h a568bf057aa249eb06fd31358b4393a5ac88c118
F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P b0853100a9f8e185e8d027502822337a79a2ba0c
R 05d593da2e562ad999268c4d47bcf9b6
P d99bde9ca61eeccfe6363ff0882fd4bcdb9a34dc
R f20bebc61397821a68a2cae56e0278b2
U drh
Z f7f774b2e1b61b0e01a61f9c5bfb1c62
Z 1fcddebe9a4cc8ca7d7de11a8e8fa230

View File

@@ -1 +1 @@
d99bde9ca61eeccfe6363ff0882fd4bcdb9a34dc
618a83d65f973183d21245721dc656a35ff594a4

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.678 2009/07/11 13:13:12 drh Exp $
** $Id: btree.c,v 1.679 2009/07/11 17:04:09 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -2852,13 +2852,14 @@ static int autoVacuumCommit(BtShared *pBt){
invalidateAllOverflowCache(pBt);
assert(pBt->autoVacuum);
if( !pBt->incrVacuum ){
Pgno nFin;
Pgno nFree;
Pgno nPtrmap;
Pgno iFree;
const int pgsz = pBt->pageSize;
Pgno nOrig = pagerPagecount(pBt);
Pgno nFin; /* Number of pages to be freed */
Pgno nFree; /* Number of pages no the freelist */
Pgno nPtrmap; /* Number of PtrMap pages to be freed */
Pgno iFree; /* The next page to be freed */
int nEntry; /* Number of entries on one ptrmap page */
Pgno nOrig; /* Database size before freeing */
nOrig = pagerPagecount(pBt);
if( PTRMAP_ISPAGE(pBt, nOrig) || nOrig==PENDING_BYTE_PAGE(pBt) ){
/* It is not possible to create a database for which the final page
** is either a pointer-map page or the pending-byte page. If one
@@ -2868,7 +2869,8 @@ static int autoVacuumCommit(BtShared *pBt){
}
nFree = get4byte(&pBt->pPage1->aData[36]);
nPtrmap = (nFree-nOrig+PTRMAP_PAGENO(pBt, nOrig)+pgsz/5)/(pgsz/5);
nEntry = pBt->usableSize/5;
nPtrmap = (nFree-nOrig+PTRMAP_PAGENO(pBt, nOrig)+nEntry)/nEntry;
nFin = nOrig - nFree - nPtrmap;
if( nOrig>PENDING_BYTE_PAGE(pBt) && nFin<PENDING_BYTE_PAGE(pBt) ){
nFin--;