]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Auto-vacuum bugfix: Do not attempt to move a pointer-map page during auto-vacuum...
authordanielk1977 <danielk1977@noemail.net>
Wed, 3 Nov 2004 03:52:37 +0000 (03:52 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 3 Nov 2004 03:52:37 +0000 (03:52 +0000)
FossilOrigin-Name: bd50fbb5fecd1829c87e8ca72c458c71f590274b

manifest
manifest.uuid
src/btree.c

index a2cbe4553ccf2369288a08c1f373773031d9ba59..65b980d5c8529f0db74c7bb860a2a18c3ac44a14 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\san\sauto-vacuum\sbug\sthat\soccurs\swhen\sa\sbtree\scell\sis\spromoted\sto\sthe\sparent\spage\sduring\sa\sdelete.\s(CVS\s2043)
-D 2004-11-03T03:01:17
+C Auto-vacuum\sbugfix:\sDo\snot\sattempt\sto\smove\sa\spointer-map\spage\sduring\sauto-vacuum.\s(CVS\s2044)
+D 2004-11-03T03:52:37
 F Makefile.in 9e90c685d69f09039015a6b1f3b0a48e9738c9e5
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@@ -29,7 +29,7 @@ F sqlite3.def dbaeb20c153e1d366e8f421b55a573f5dfc00863
 F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
 F src/attach.c e49d09dad9f5f9fb10b4b0c1be5a70ae4c45e689
 F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea
-F src/btree.c 2f7cfc724b2c34a046cee11ca12582d786e50308
+F src/btree.c e243f8927f827337ecd316da9f4a15790b7b33cf
 F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
 F src/build.c bb896c5f85ab749d17ae5d730235134c12c08033
 F src/date.c 34bdb0082db7ec2a83ef00063f7b44e61ee19dad
@@ -252,7 +252,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
-P a2c9c45c803350f45911a72eb61efa9c3089f8ca
-R c5211669f5d9e58d9ee4a32f7514f865
+P b7d953e1195897de4869ec241a65e8a3d1320efb
+R e185cf7676cc794eee9060c09350688b
 U danielk1977
-Z a5ce17377bb4e63f27099031250fb3aa
+Z 0648ce34f782ce635735be96e8684487
index 488bbbae1ce36ef1a704c04ae301d8888fc602c6..8c4d612636dfffe6ae84f1bdec452c83eac76769 100644 (file)
@@ -1 +1 @@
-b7d953e1195897de4869ec241a65e8a3d1320efb
\ No newline at end of file
+bd50fbb5fecd1829c87e8ca72c458c71f590274b
\ No newline at end of file
index 99bd68bd667d7b94413854d0ac61ad9d3b021bf1..66cb21622c97bfb0c3a607e6d6f24d2b88c724e3 100644 (file)
@@ -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);