From aac0a38d1ff6cd577779577605ccddbf38c47f0f Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Sun, 16 Jan 2005 11:07:06 +0000 Subject: [PATCH] Changes to make sure tests work when SQLITE_DEFAULT_AUTOVACUUM is defined. (CVS 2219) FossilOrigin-Name: 6237c294d1211d5848bafb1310574e2486a43757 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/btree.c | 9 ++++++++- test/all.test | 6 +++++- test/ioerr.test | 16 ++++++++++------ 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index 1b2f0647ba..a6a6b6e415 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fixes\sso\sthat\scompiling\sand\stesting\sworks\swhen\sSQLITE_OMIT_AUTOVACUUM\sis\sdefined.\s(CVS\s2218) -D 2005-01-16T09:06:34 +C Changes\sto\smake\ssure\stests\swork\swhen\sSQLITE_DEFAULT_AUTOVACUUM\sis\sdefined.\s(CVS\s2219) +D 2005-01-16T11:07:07 F Makefile.in 6ce51dde6a8fe82fc12f20dec750572f6a19f56a 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 77e7ab4f356418bfc1e0992919c1d5c554ebe3da +F src/btree.c 4a9313065dcfb31c702158ed4c5c0e1ed69889a8 F src/btree.h 74d19cf40ab49fd69abe9e4e12a6c321ad86c497 F src/build.c af1296e8a21a406b4f4c4f1e1365e075071219f3 F src/cursor.c f883813759742068890b1f699335872bfa8fdf41 @@ -84,7 +84,7 @@ F src/vdbeaux.c 6c294f7390880a7bb4795c9e0bc605b1a416579a F src/vdbemem.c 62fe89471b656a922e9879be005abf690509ead3 F src/where.c 3a0d08505e298242f6f151f019a05129a4f8704c F tclinstaller.tcl 36478c3bbfc5b93ceac42d94e3c736937b808432 -F test/all.test 461ed369bfa26ab5564df7a57514a17fd54069d1 +F test/all.test 67984b11ab45c9e5811fb305f8b19012dedf2a02 F test/alter.test 95c57a4f461fa81293e0dccef7f83889aadb169a F test/attach.test f39069efd4394422798f249df9a31489aa941ee1 F test/attach2.test eeb987770f4dbe68bd29afdbc2e8cff0142e6eb5 @@ -139,7 +139,7 @@ F test/insert2.test 0bb50ff999e35a21549d8ee5dc44db8ac24d31a7 F test/insert3.test fa7cb5b01709a1bca3e28c82c80c1d44386b3676 F test/interrupt.test 5b4d8389e6cf2d01b94f87cfd02d9df1073bfb2d F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194 -F test/ioerr.test f2072906ed3a8d136c8ed0dcee70a07e5cd2f061 +F test/ioerr.test 43cdd9dcbdedc2ec952031b3e53d3d5a4ee26000 F test/join.test ea8c77b9fbc377fe553cdb5ce5f1bd72021dca5d F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8 F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3 @@ -269,7 +269,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746 -P a5c2121410476ee1bf81881fdf5917e3e16f0399 -R bd23b0a3dffc23b81bb6c41f440ce89a +P fe548561a0e7a696fd453372f4427cf3e3f19d20 +R efc29d803f831313057d41111eb84268 U danielk1977 -Z 357ec6a25a79ec0e067fcb4be6fdfd6c +Z 437c229bfd7b7a9b1f6b1f483648fd2d diff --git a/manifest.uuid b/manifest.uuid index 44581a8e93..f390b539b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fe548561a0e7a696fd453372f4427cf3e3f19d20 \ No newline at end of file +6237c294d1211d5848bafb1310574e2486a43757 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index a969dd195c..2b68165de6 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.236 2005/01/16 09:06:34 danielk1977 Exp $ +** $Id: btree.c,v 1.237 2005/01/16 11:07:07 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -3070,6 +3070,9 @@ static int allocatePage( if( rc==SQLITE_OK ){ sqlite3pager_dont_rollback((*ppPage)->aData); rc = sqlite3pager_write((*ppPage)->aData); + if( rc!=SQLITE_OK ){ + releasePage(*ppPage); + } } searchList = 0; } @@ -3098,6 +3101,9 @@ static int allocatePage( rc = getPage(pBt, *pPgno, ppPage); if( rc ) return rc; rc = sqlite3pager_write((*ppPage)->aData); + if( rc!=SQLITE_OK ){ + releasePage(*ppPage); + } TRACE(("ALLOCATE: %d from end of file\n", *pPgno)); } @@ -4294,6 +4300,7 @@ static int balance_shallower(MemPage *pPage){ assert( pPage->nOverflow==0 ); #ifndef SQLITE_OMIT_AUTOVACUUM if( pBt->autoVacuum ){ + int i; for(i=0; inCell; i++){ rc = ptrmapPutOvfl(pPage, i); if( rc!=SQLITE_OK ){ diff --git a/test/all.test b/test/all.test index 3674ba90a6..0c73c39860 100644 --- a/test/all.test +++ b/test/all.test @@ -10,7 +10,7 @@ #*********************************************************************** # This file runs all tests. # -# $Id: all.test,v 1.27 2005/01/13 11:07:54 danielk1977 Exp $ +# $Id: all.test,v 1.28 2005/01/16 11:07:07 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -61,9 +61,13 @@ set EXCLUDE { # SQLITE_DEFAULT_AUTOVACUUM macro is defined to true (because they depend # on tables being allocated starting at page 2). # +# Also corrupt.test doesn't work, because currently SQLite can't detect +# corruption in pointer-map pages. +# ifcapable default_autovacuum { lappend EXCLUDE btree2.test lappend EXCLUDE btree4.test + lappend EXCLUDE corrupt.test } for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} { diff --git a/test/ioerr.test b/test/ioerr.test index 63ed95dfa9..9daaf94bdb 100644 --- a/test/ioerr.test +++ b/test/ioerr.test @@ -15,7 +15,7 @@ # The tests in this file use special facilities that are only # available in the SQLite test fixture. # -# $Id: ioerr.test,v 1.14 2005/01/16 09:06:34 danielk1977 Exp $ +# $Id: ioerr.test,v 1.15 2005/01/16 11:07:07 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -199,7 +199,7 @@ do_ioerr_test 3 -tclprep { UPDATE abc SET a = randstr(90,90); COMMIT; CREATE TABLE abc3(a); -} +} # Test IO errors that can occur retrieving a record header that flows over # onto an overflow page. @@ -217,8 +217,12 @@ do_ioerr_test 4 -tclprep { # Test IO errors that may occur during a multi-file commit. # -# Test 8 is excluded when auto-vacuum is enabled for the same reason -# as in test cases ioerr-1.XXX +# Tests 8 and 17 are excluded when auto-vacuum is enabled for the same +# reason as in test cases ioerr-1.XXX +set ex "" +if {[string match [execsql {pragma auto_vacuum}] 1]} { + set ex [list 8 17] +} do_ioerr_test 5 -sqlprep { ATTACH 'test2.db' AS test2; } -sqlbody { @@ -226,7 +230,7 @@ do_ioerr_test 5 -sqlprep { CREATE TABLE t1(a,b,c); CREATE TABLE test2.t2(a,b,c); COMMIT; -} -exclude [expr [string match [execsql {pragma auto_vacuum}] 1] ? 8 : 0] +} -exclude $ex # Test IO errors when replaying two hot journals from a 2-file # transaction. This test only runs on UNIX. @@ -252,7 +256,7 @@ if {$tcl_platform(platform)=="unix" && [file exists ./crashtest]} { # Test handling of IO errors that occur while rolling back hot journal # files. -do_ioerr_test 14 -tclprep { +do_ioerr_test 7 -tclprep { db close sqlite3 db2 test2.db db2 eval {