]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix bug introduced with (2057). (CVS 2058)
authordanielk1977 <danielk1977@noemail.net>
Fri, 5 Nov 2004 01:45:13 +0000 (01:45 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Fri, 5 Nov 2004 01:45:13 +0000 (01:45 +0000)
FossilOrigin-Name: aed2e623ec9c4044696dc2d6f7f4c53216b45479

manifest
manifest.uuid
src/btree.c

index 0e1b1c732bf76955f0b3a88ef12a8de94041e690..50f81b3f4f9b9596df04b2e9db113d16922a0163 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Pop\sthe\svalue\spushed\sby\sOP_Destroy\sif\sSQLITE_OMIT_AUTOVACUUM\sis\sdefined.\s(CVS\s2057)
-D 2004-11-05T01:24:13
+C Fix\sbug\sintroduced\swith\s(2057).\s(CVS\s2058)
+D 2004-11-05T01:45:14
 F Makefile.in c4d2416860f472a1e3393714d0372074197565df
 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 1b172b9d58608eeba1022e858fedce351c7090f5
+F src/btree.c 832ea4553803ff18e6cfc299cb5bf266d3f100aa
 F src/btree.h 3166388fa58c5594d8064d38b43440d79da38fb6
 F src/build.c 6e00bcc31c003dc0bf783f777aae7698fdad219a
 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 10c3d88305e404b9e4cc4eef0b8e5dc7864a5937
-R 55c62c93629a83443d5cecea7a9680ce
+P b0c103340ad27533d3e5b2f1b18557fd9c8b55df
+R 03fae3dd272be36dc35894b6aa50fefb
 U danielk1977
-Z 0115f45c7d1aac8b14a4bee705da57a2
+Z 809037e96143592365a1e575bfe4ff28
index 52dac4a41a226fc13a4ac1963b2a999275d5b8d8..a14e006d7a60c376cb1e76fc0e6ea5e2eb5bb94f 100644 (file)
@@ -1 +1 @@
-b0c103340ad27533d3e5b2f1b18557fd9c8b55df
\ No newline at end of file
+aed2e623ec9c4044696dc2d6f7f4c53216b45479
\ No newline at end of file
index 3b53e7dbc89f5a8677ce5df6b60e66e8166713b3..7c08f70fb9eb36bbda7af9e523e92ee965f79c0c 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.205 2004/11/05 00:43:12 drh Exp $
+** $Id: btree.c,v 1.206 2004/11/05 01:45:14 danielk1977 Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** For a detailed discussion of BTrees, refer to
@@ -1754,7 +1754,9 @@ static int autoVacuumCommit(Btree *pBt){
     if( rc!=SQLITE_OK ) goto autovacuum_out;
     assert( eType!=PTRMAP_ROOTPAGE );
 
-    /* If iDbPage is a free or pointer map page, do not swap it. */
+    /* If iDbPage is a free or pointer map page, do not swap it.
+    ** Instead, make sure the page is in the journal file.
+    */
     if( eType==PTRMAP_FREEPAGE || PTRMAP_ISPAGE(pgsz, iDbPage) ){
       continue;
     }
@@ -2956,10 +2958,14 @@ static int freePage(MemPage *pPage){
 
 #ifndef SQLITE_OMIT_AUTOVACUUM
   /* If the database supports auto-vacuum, write an entry in the pointer-map
-  ** to indicate that the page is free.
+  ** to indicate that the page is free. Also make sure the page is in
+  ** the journal file.
   */
   if( pBt->autoVacuum ){
     rc = ptrmapPut(pBt, pPage->pgno, PTRMAP_FREEPAGE, 0);
+    if( rc ) return rc;
+    rc = sqlite3pager_write(pPage->aData);
+    if( rc ) return rc;
   }
 #endif
 
@@ -4254,9 +4260,14 @@ int sqlite3BtreeCreateTable(Btree *pBt, int *piTable, int flags){
     ** not really necessary, but it avoids complications in dealing with
     ** a free-list in the code below.
     ** TODO: This may need to be revisited.
+    ** TODO2: Actually this is no-good. running the auto-vacuum routine
+    **        involves truncating the database, which means the journal-file
+    **        must be synced(). No-good.
     */
+/*
     rc = autoVacuumCommit(pBt);
     if( rc!=SQLITE_OK ) return rc;
+*/
 
     /* Read the value of meta[3] from the database to determine where the
     ** root page of the new table should go. meta[3] is the largest root-page
@@ -4276,7 +4287,7 @@ int sqlite3BtreeCreateTable(Btree *pBt, int *piTable, int flags){
     ** be moved to the allocated page (unless the allocated page happens
     ** to reside at pgnoRoot).
     */
-    rc = allocatePage(pBt, &pPageMove, &pgnoMove, 0);
+    rc = allocatePage(pBt, &pPageMove, &pgnoMove, 1);
     if( rc!=SQLITE_OK ){
       return rc;
     }
@@ -4292,6 +4303,7 @@ int sqlite3BtreeCreateTable(Btree *pBt, int *piTable, int flags){
       }
       rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);
       assert( eType!=PTRMAP_ROOTPAGE );
+      assert( eType!=PTRMAP_FREEPAGE );
       if( rc!=SQLITE_OK ){
         releasePage(pRoot);
         return rc;