]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix an assert() failure occuring in corrupt.test. (CVS 4034)
authordanielk1977 <danielk1977@noemail.net>
Thu, 24 May 2007 07:22:42 +0000 (07:22 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 24 May 2007 07:22:42 +0000 (07:22 +0000)
FossilOrigin-Name: 3c54cddf23e3b9f62815d1b825110563f78cc325

manifest
manifest.uuid
src/btree.c
src/pager.c
test/incrvacuum.test

index f4a44c89b8640f7c52df6d2087dee05b7ad483af..4c82465a262637702ec2704decff12b23abae816 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\ssome\scode\sto\sMemTranslate()\sto\sprevent\sthe\sREAD_UTF8()\smacro\sfrom\soverreading\sa\sbuffer.\s(CVS\s4033)
-D 2007-05-23T16:23:09
+C Fix\san\sassert()\sfailure\soccuring\sin\scorrupt.test.\s(CVS\s4034)
+D 2007-05-24T07:22:42
 F Makefile.in a42354804b50c2708ce72cf79e4daa30f50191b5
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -62,7 +62,7 @@ F src/alter.c 1b1deeb97446ed87f2fa17a3eb6236548841a348
 F src/analyze.c e8fcb1c35ace8418615eb18d9601f321ac86b2ec
 F src/attach.c ba628db0c2b6a362f036d017bf1196cdfe4ebb37
 F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb
-F src/btree.c 7e3d0c6a9e9be836a0acbf2b80759193130d9059
+F src/btree.c 125ff88b8a0eaae2acd48b42decad569f41c268a
 F src/btree.h 1d527bf61ed176f980c34999d5793a0fd45dcf8c
 F src/btreeInt.h f92c0577f49d961c0148b477a25647e8fd80eecf
 F src/build.c 50992d92e131a9aa9aa6657fb1ddc13e176fd70c
@@ -93,7 +93,7 @@ F src/os_unix.c cb1fb044b84870c7b1b8b2902e9d7be779f8b7ce
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
 F src/os_win.c d868d5f9e95ec9c1b9e2a30c54c996053db6dddd
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c acfa86f50b71b7e289508b213bb88e68273d42a0
+F src/pager.c 9fa154fbc5f511dedadc9f9df87df6b103c0303a
 F src/pager.h 94110a5570dca30d54a883e880a3633b2e4c05ae
 F src/parse.y e276a0c35d6579938708f0842d0eba4e9b6866e6
 F src/pragma.c 0d25dad58bdfd6789943a10f1b9663c2eb85b96d
@@ -258,7 +258,7 @@ F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
 F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055
 F test/incrblob.test 7f82ae497364612aa17a37f77f12e01e2bee9f20
 F test/incrblob_err.test 2501bec57e317e7051451b5093b47fc61a96c85a
-F test/incrvacuum.test 81de75c6178721a1fce9804a3a0509f5e7d8fa89
+F test/incrvacuum.test 9dd849d393280352b06d94aa7a69ae969c1635d9
 F test/incrvacuum2.test 82397ceb5941cbe852fd29bb33fcdf5665bc80c2
 F test/incrvacuum_ioerr.test cb331403b8dea3c5bae6163861ff25037b0df56a
 F test/index.test e65df12bed94b2903ee89987115e1578687e9266
@@ -494,7 +494,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P efd7bcb34c1b4a0a3d4b954b90dfee93ac87bc86
-R f0050ec825035e61175a444a0e964e8b
+P 0595319cd716611bb5a12eb952e395283ea749bb
+R e915c377db312aa08a1ede5669a4b334
 U danielk1977
-Z ab8438e332b43e7af6a525defe04ba8f
+Z a909538d06b93140117bffbc9c2c6eaf
index 926abd8478adf4a7f1271dd108cd59136d4671c4..ee5dc620077771e0371962d73d4fea1c40c902f4 100644 (file)
@@ -1 +1 @@
-0595319cd716611bb5a12eb952e395283ea749bb
\ No newline at end of file
+3c54cddf23e3b9f62815d1b825110563f78cc325
\ No newline at end of file
index 6d482709cc5a2308fabbc70019b25cc65f8c02ba..4ee9de0f3515d2ecb1f4aacbdbb8b3cef33e7716 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.385 2007/05/23 13:34:32 danielk1977 Exp $
+** $Id: btree.c,v 1.386 2007/05/24 07:22:42 danielk1977 Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -1659,12 +1659,15 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
 static int setChildPtrmaps(MemPage *pPage){
   int i;                             /* Counter variable */
   int nCell;                         /* Number of cells in page pPage */
-  int rc = SQLITE_OK;                /* Return code */
+  int rc;                            /* Return code */
   BtShared *pBt = pPage->pBt;
   int isInitOrig = pPage->isInit;
   Pgno pgno = pPage->pgno;
 
-  sqlite3BtreeInitPage(pPage, 0);
+  rc = sqlite3BtreeInitPage(pPage, pPage->pParent);
+  if( rc!=SQLITE_OK ){
+    goto set_child_ptrmaps_out;
+  }
   nCell = pPage->nCell;
 
   for(i=0; i<nCell; i++){
index 7e987de79a8cb0c531e43ea971cdef288639b1d8..0b435438c892f12788d97d504c686cfe78ee03be 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.340 2007/05/09 20:35:31 drh Exp $
+** @(#) $Id: pager.c,v 1.341 2007/05/24 07:22:42 danielk1977 Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -1081,6 +1081,10 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
   ** page in the pager cache. In this case just update the pager cache,
   ** not the database file. The page is left marked dirty in this case.
   **
+  ** An exception to the above rule: If the database is in no-sync mode
+  ** and a page is moved during an incremental vacuum then the page may
+  ** not be in the pager cache.
+  **
   ** If in EXCLUSIVE state, then we update the pager cache if it exists
   ** and the main file. The page is then marked not dirty.
   **
@@ -1098,7 +1102,7 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
   ** cache or else it is marked as needSync==0.
   */
   pPg = pager_lookup(pPager, pgno);
-  assert( pPager->state>=PAGER_EXCLUSIVE || pPg!=0 );
+  assert( pPager->state>=PAGER_EXCLUSIVE || pPg!=0 || pPager->noSync );
   PAGERTRACE3("PLAYBACK %d page %d\n", PAGERID(pPager), pgno);
   if( pPager->state>=PAGER_EXCLUSIVE && (pPg==0 || pPg->needSync==0) ){
     rc = sqlite3OsSeek(pPager->fd, (pgno-1)*(i64)pPager->pageSize);
index bbf9d9f1f085a6ffe552b6d6bbe3f02ae172d65a..54ffa64ac1a72524d545f130530d79c4deb64f7c 100644 (file)
@@ -14,7 +14,7 @@
 # Note: There are also some tests for incremental vacuum and IO 
 # errors in incrvacuum_ioerr.test.
 #
-# $Id: incrvacuum.test,v 1.8 2007/05/23 13:50:24 danielk1977 Exp $
+# $Id: incrvacuum.test,v 1.9 2007/05/24 07:22:42 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -452,4 +452,52 @@ do_test incrvacuum-8.1 {
   }
 } {}
 
+#---------------------------------------------------------------------
+# At one point this test case was causing an assert() to fail.
+#
+do_test incrvacuum-9.1 {
+  db close
+  file delete -force test.db test.db-journal
+  sqlite3 db test.db
+
+  execsql {
+    PRAGMA auto_vacuum = 'incremental';
+    CREATE TABLE t1(a, b, c);
+    CREATE TABLE t2(a, b, c);
+    INSERT INTO t2 VALUES(randstr(500,500),randstr(500,500),randstr(500,500));
+    INSERT INTO t1 VALUES(1, 2, 3);
+    INSERT INTO t1 SELECT a||a, b||b, c||c FROM t1;
+    INSERT INTO t1 SELECT a||a, b||b, c||c FROM t1;
+    INSERT INTO t1 SELECT a||a, b||b, c||c FROM t1;
+    INSERT INTO t1 SELECT a||a, b||b, c||c FROM t1;
+    INSERT INTO t1 SELECT a||a, b||b, c||c FROM t1;
+    INSERT INTO t1 SELECT a||a, b||b, c||c FROM t1;
+    INSERT INTO t1 SELECT a||a, b||b, c||c FROM t1;
+    INSERT INTO t1 SELECT a||a, b||b, c||c FROM t1;
+  }
+} {}
+
+do_test incrvacuum-9.2 {
+  execsql {
+    PRAGMA synchronous = 'OFF';
+    BEGIN;
+    UPDATE t1 SET a = a, b = b, c = c;
+    DROP TABLE t2;
+    PRAGMA incremental_vacuum(10);
+    ROLLBACK;
+  }
+} {}
+
+do_test incrvacuum-9.3 {
+  execsql {
+    PRAGMA cache_size = 10;
+    BEGIN;
+    UPDATE t1 SET a = a, b = b, c = c;
+    DROP TABLE t2;
+    PRAGMA incremental_vacuum(10);
+    ROLLBACK;
+  }
+} {}
+
 finish_test
+