From: drh Date: Sat, 19 Apr 2008 20:53:26 +0000 (+0000) Subject: Add some tests for journal_mode=off. Need to come up with a way of handling X-Git-Tag: version-3.6.10~1143 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5cd62569508374fd5060e89a09c62a253af2c82f;p=thirdparty%2Fsqlite.git Add some tests for journal_mode=off. Need to come up with a way of handling rollback attempts when there is no journal. (CVS 5034) FossilOrigin-Name: e29b870ed0db6360a95fb017f56c0b5388efb437 --- diff --git a/manifest b/manifest index 9bfb975542..aff99292ec 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Continuing\swork\son\sjournal_mode.\s\sJournal_mode=persist\snow\sappears\sto\sbe\nworking,\sthough\sadditional\stesting\swould\sbe\swelcomed.\s(CVS\s5033) -D 2008-04-19T20:34:19 +C Add\ssome\stests\sfor\sjournal_mode=off.\s\sNeed\sto\scome\sup\swith\sa\sway\sof\shandling\nrollback\sattempts\swhen\sthere\sis\sno\sjournal.\s(CVS\s5034) +D 2008-04-19T20:53:26 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -127,7 +127,7 @@ F src/os_unix.c fdec4e5ee5dd555a6ad4a69f38ab35f0788536b4 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_win.c 3a60bddd07ea6f8adb2314dd5996ac97b988f403 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b -F src/pager.c c768b50502ba451abd0318bb9ba5485d410f7a56 +F src/pager.c 008ec5a602d2e8c2f46fff64468fffd6537ed938 F src/pager.h 45ec2188593afd48a25c743529646771d75e83e4 F src/parse.y fc4bd35c6088901f7c8daead26c6fb11c87d22e7 F src/pragma.c 2e4bb2e76e48a32750529fdc4bfe86ac5f54e01b @@ -252,7 +252,7 @@ F test/createtab.test 199cf68f44e5d9e87a0b8afc7130fdeb4def3272 F test/cse.test 4b8a49decaefccb835ecc67249277be491713f6c F test/date.test be0a3a30f5009b1cbc1a9c396b1fe96bd18522cc F test/default.test 252298e42a680146b1dd64f563b95bdf088d94fb -F test/delete.test 57533e88e886608bf5ae0f394e14c2eb1b1f7754 +F test/delete.test f171c1011395a8dd63169438fe1d8cc625eb7442 F test/delete2.test c06be3806ba804bc8c6f134476816080280b40e3 F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab F test/descidx1.test a13d443571e045b61b1b2b759df8dcffa092c968 @@ -357,8 +357,9 @@ F test/join4.test 1a352e4e267114444c29266ce79e941af5885916 F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19 F test/jrnlmode.test 89acaa81503e349a49da73570b1a104f8fd93de7 -F test/jrnlmode2.test 7a85f226203ef9ad9550ae87e810c2cc15a983cd -F test/jrnlmode3.test 6d2abb167496eea53042defc0d1d8f4d2a4f4fc4 +F test/jrnlmode2.test 0e88856faaf4ea7449751cd427ecd670bed92a31 +F test/jrnlmode3.test c77f9d4095945f234dddd60ca0f73c24802ed0c1 +F test/jrnlmode4.test ad08b0ee3e1470c10a32785959252ef0c7c4f479 F test/lastinsert.test 474d519c68cb79d07ecae56a763aa7f322c72f51 F test/laststmtchanges.test 18ead86c8a87ade949a1d5658f6dc4bb111d1b02 F test/like.test 2a3ddbd5d91503f914eabae67a47c4196fe33a58 @@ -634,7 +635,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P adcef73b3925266a14a552cd9b06c14f22aaefc8 -R d27c89575f3638e072ac7a32dcbb259c +P 277e4099cee9105e1801a6d7f5d477f0d2efa858 +R 91f87b04b1a638984e55a8af93bfa847 U drh -Z 0ef93974814e7b17c541e821a40a0bd5 +Z 5219086565bb85263845c2c6918f4999 diff --git a/manifest.uuid b/manifest.uuid index bdf5f670a5..3a294312ae 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -277e4099cee9105e1801a6d7f5d477f0d2efa858 \ No newline at end of file +e29b870ed0db6360a95fb017f56c0b5388efb437 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 02ffc56dcd..5a18dfa1ef 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.430 2008/04/19 20:34:19 drh Exp $ +** @(#) $Id: pager.c,v 1.431 2008/04/19 20:53:26 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -1393,7 +1393,6 @@ static int pager_end_transaction(Pager *pPager){ pPager->nRec = 0; }else{ assert( pPager->pInJournal==0 ); - assert( pPager->dirtyCache==0 || pPager->useJournal==0 ); } if( !pPager->exclusiveMode ){ @@ -4624,7 +4623,6 @@ int sqlite3PagerCommitPhaseOne( ** transaction the m-j name will have already been written. */ if( !pPager->setMaster ){ - assert( pPager->journalOpen ); rc = pager_incr_changecounter(pPager, 0); if( rc!=SQLITE_OK ) goto sync_exit; #ifndef SQLITE_OMIT_AUTOVACUUM @@ -4745,7 +4743,6 @@ int sqlite3PagerCommitPhaseTwo(Pager *pPager){ pagerLeave(pPager); return SQLITE_OK; } - assert( pPager->journalOpen || !pPager->dirtyCache ); assert( pPager->state==PAGER_SYNCED || !pPager->dirtyCache ); rc = pager_end_transaction(pPager); rc = pager_error(pPager, rc); diff --git a/test/delete.test b/test/delete.test index 909a00964b..fc7e81df95 100644 --- a/test/delete.test +++ b/test/delete.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the DELETE FROM statement. # -# $Id: delete.test,v 1.22 2007/10/05 15:53:29 danielk1977 Exp $ +# $Id: delete.test,v 1.23 2008/04/19 20:53:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -275,6 +275,7 @@ do_test delete-8.0 { } } {123} db close +catch {file delete -force test.db-journal} catch {file attributes test.db -permissions 0444} catch {file attributes test.db -readonly 1} sqlite3 db test.db diff --git a/test/jrnlmode2.test b/test/jrnlmode2.test index 4e3d6b9d01..d3b304ff80 100644 --- a/test/jrnlmode2.test +++ b/test/jrnlmode2.test @@ -12,7 +12,7 @@ # This file runs the tests in the file ioerr.test with # persistent journal mode enabled. # -# $Id: jrnlmode2.test,v 1.1 2008/04/19 20:34:19 drh Exp $ +# $Id: jrnlmode2.test,v 1.2 2008/04/19 20:53:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -42,11 +42,15 @@ proc do_test {args} { eval $sc } -source $testdir/vacuum.test +source $testdir/delete.test +source $testdir/delete2.test +source $testdir/insert.test source $testdir/rollback.test source $testdir/select1.test source $testdir/select2.test source $testdir/trans.test +source $testdir/update.test +source $testdir/vacuum.test rename sqlite3 "" diff --git a/test/jrnlmode3.test b/test/jrnlmode3.test index 45c4e901fd..61206001ce 100644 --- a/test/jrnlmode3.test +++ b/test/jrnlmode3.test @@ -12,7 +12,7 @@ # This file runs the tests in the file ioerr.test with # persistent journal mode enabled. # -# $Id: jrnlmode3.test,v 1.1 2008/04/19 20:34:19 drh Exp $ +# $Id: jrnlmode3.test,v 1.2 2008/04/19 20:53:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -37,7 +37,7 @@ proc sqlite3 {args} { rename do_test really_do_test proc do_test {args} { - set sc [concat really_do_test "jrlnmode2-[lindex $args 0]" \ + set sc [concat really_do_test "jrlnmode3-[lindex $args 0]" \ [lrange $args 1 end]] eval $sc } diff --git a/test/jrnlmode4.test b/test/jrnlmode4.test new file mode 100644 index 0000000000..d1d5aaeb09 --- /dev/null +++ b/test/jrnlmode4.test @@ -0,0 +1,60 @@ +# 2007 March 26 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file runs the tests in the file ioerr.test with +# persistent journal mode enabled. +# +# $Id: jrnlmode4.test,v 1.1 2008/04/19 20:53:26 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +ifcapable {!pager_pragmas} { + finish_test + return +} + +rename finish_test really_finish_test2 +proc finish_test {} {} +set ISQUICK 1 + +rename sqlite3 real_sqlite3 +proc sqlite3 {args} { + set r [eval "real_sqlite3 $args"] + if { [llength $args] == 2 } { + [lindex $args 0] eval {PRAGMA journal_mode = off} + } + set r +} + +rename do_test really_do_test +proc do_test {args} { + set sc [concat really_do_test "jrlnmode4-[lindex $args 0]" \ + [lrange $args 1 end]] + eval $sc +} + +source $testdir/delete.test +source $testdir/delete2.test +source $testdir/insert.test +source $testdir/select1.test +source $testdir/select2.test +source $testdir/update.test +source $testdir/vacuum.test + + +rename sqlite3 "" +rename real_sqlite3 sqlite3 +rename finish_test "" +rename really_finish_test2 finish_test +rename do_test "" +rename really_do_test do_test +finish_test