From 89a4be8af1fb5efbaee195f6cd4c3f3f5ab23bb3 Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Wed, 23 May 2007 13:34:32 +0000 Subject: [PATCH] Fix a leaked page reference that could occur after an IO error in auto-vacuum databases. Also modify incrvacuum.test to work with DEFAULT_AUTOVACUUM=1 builds. (CVS 4031) FossilOrigin-Name: e691f2fa3d8c1bbb66d27eea299ae2fb1ea1a16d --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/btree.c | 10 +++++----- test/incrvacuum.test | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 5db49b98db..0d7340ae32 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sdatabase\scorrupting\sbug\sin\sthe\soptimistic\soverflow\schain.\sExposed\sby\srunning\sbigrow.test\swith\sauto-vacuum\senabled.\s(CVS\s4030) -D 2007-05-23T09:52:42 +C Fix\sa\sleaked\spage\sreference\sthat\scould\soccur\safter\san\sIO\serror\sin\sauto-vacuum\sdatabases.\sAlso\smodify\sincrvacuum.test\sto\swork\swith\sDEFAULT_AUTOVACUUM=1\sbuilds.\s(CVS\s4031) +D 2007-05-23T13:34:32 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 8b39c5aad153744919c79efbeca92a17e5167c2f +F src/btree.c 7e3d0c6a9e9be836a0acbf2b80759193130d9059 F src/btree.h 1d527bf61ed176f980c34999d5793a0fd45dcf8c F src/btreeInt.h f92c0577f49d961c0148b477a25647e8fd80eecf F src/build.c 50992d92e131a9aa9aa6657fb1ddc13e176fd70c @@ -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 f490c8ae86f2ecca622425d02e27d3119058cb21 +F test/incrvacuum.test 0c88ba35bd6ba1ce2dc9ac953911481d2e626acc 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 dd48a31e671de09f59661b2ba1a20e7b9f09099a -R 0a4b7a5a7560782609618616930efe42 +P 10ee2d50cbcdcbbd8141ff2aba4fd2c0c0b70d67 +R e6f6e35a3430fe940ba19e54e2cd3045 U danielk1977 -Z 355df7558cb933d10fd908dea6dfeba4 +Z 7dafc679264f64c59efbb8f3edda007b diff --git a/manifest.uuid b/manifest.uuid index 0f1c5b30d8..d29ac8448c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -10ee2d50cbcdcbbd8141ff2aba4fd2c0c0b70d67 \ No newline at end of file +e691f2fa3d8c1bbb66d27eea299ae2fb1ea1a16d \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 3d3a64d9ef..6d482709cc 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.384 2007/05/23 09:52:42 danielk1977 Exp $ +** $Id: btree.c,v 1.385 2007/05/23 13:34:32 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. @@ -3808,7 +3808,6 @@ static int fillInCell( Pgno pgnoOvfl = 0; int nHeader; CellInfo info; - Pgno pgnoFirstOvfl = 0; /* Fill in the header. */ nHeader = 0; @@ -3853,7 +3852,7 @@ static int fillInCell( } while( PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt) ); - if( pgnoOvfl>1 && pgnoOvfl!=pgnoFirstOvfl ){ + if( pgnoOvfl>1 ){ /* isExact = 1; */ } } @@ -3873,8 +3872,9 @@ static int fillInCell( if( pBt->autoVacuum && rc==SQLITE_OK ){ u8 eType = (pgnoPtrmap?PTRMAP_OVERFLOW2:PTRMAP_OVERFLOW1); rc = ptrmapPut(pBt, pgnoOvfl, eType, pgnoPtrmap); - }else{ - pgnoFirstOvfl = pgnoOvfl; + if( rc ){ + releasePage(pOvfl); + } } #endif if( rc ){ diff --git a/test/incrvacuum.test b/test/incrvacuum.test index 7eabafc075..269d6a4cd4 100644 --- a/test/incrvacuum.test +++ b/test/incrvacuum.test @@ -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.6 2007/05/04 18:30:41 drh Exp $ +# $Id: incrvacuum.test,v 1.7 2007/05/23 13:34:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -33,7 +33,7 @@ do_test incrvacuum-1.1 { execsql { pragma auto_vacuum; } -} {0} +} $sqlite_options(default_autovacuum) do_test incrvacuum-1.2 { execsql { pragma auto_vacuum = 'full';