From: shaneh Date: Tue, 24 Aug 2010 18:35:12 +0000 (+0000) Subject: Changes to support building with SQLITE_OMIT_WAL. X-Git-Tag: experimental~122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9091f775a86e4db458a84eead34de0842d297b8a;p=thirdparty%2Fsqlite.git Changes to support building with SQLITE_OMIT_WAL. FossilOrigin-Name: d1ed743b6ed07ad0ee7d466932c5a83caa9489ee --- diff --git a/manifest b/manifest index b1272f9697..707e69bb70 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,5 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -C Change\ssqlite3_open_v2()\sto\sreturn\sSQLITE_MISUSE\sif\sthe\scombination\sof\sbits\nin\sthe\sflags\sparameter\sis\sinvalid.\s\sThe\sdocumentation\ssays\sthe\sbehavior\sin\s\nthis\ssituation\sis\sundefined\s-\sthe\sdocumentation\sis\sunaltered\sby\sthis\scode\s\nchange. -D 2010-08-24T18:07:58 +C Changes\sto\ssupport\sbuilding\swith\sSQLITE_OMIT_WAL. +D 2010-08-24T18:35:12 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -159,7 +156,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e F src/os_unix.c 11194cbcf6a57456e58022dc537ab8c3497d9bb9 F src/os_win.c 51cb62f76262d961ea4249489383d714501315a7 -F src/pager.c a5f5d9787b11dfb0b6082e6f5846d00b459a8e19 +F src/pager.c 48556db031d16064ffbde48053da8ec5032df7e8 F src/pager.h ef8c8f71ab022cc2fff768a1175dd32355be9dcd F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07 @@ -543,7 +540,7 @@ F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347 F test/null.test a8b09b8ed87852742343b33441a9240022108993 F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec -F test/pager1.test 6922029d71a8090169c71a67a141b6b94ad17d50 +F test/pager1.test 12ad20280db1ba25f1f0d7ddebf0971a305d8f80 F test/pager2.test 0fbb6b6dc40ce1fecfe758c555a748ad2e9beaa3 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f F test/pagerfault.test 84c6a4fcfe1a9e450fc1cec86f5baebfb017e53e @@ -613,7 +610,7 @@ F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715 F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b F test/sqllimits1.test e90a0ed94452076f6a10209d378e06b5f75ef0a0 -F test/stat.test 70fe540ffb285947aead5533dfd0c8c12f17f14e +F test/stat.test 3c18f0698e1a56c67e75b55c398332a3ffba579a F test/stmt.test 7915bd3e8380b956c095f40f41a775a30716e649 F test/subquery.test b524f57c9574b2c0347045b4510ef795d4686796 F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4 @@ -800,7 +797,7 @@ F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142 F test/walfault.test 05c470688d742688e455dd56816bd6bcffa298f8 F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483 F test/walmode.test 4ecd37284f245247f7935896ab66f6943f0432a0 -F test/walshared.test 985b4a3406b2b2dace1d52a42d26a11dd6900981 +F test/walshared.test 6dda2293880c300baf5d791c307f653094585761 F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933 F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c F test/where.test de337a3fe0a459ec7c93db16a519657a90552330 @@ -849,14 +846,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P c2dc39c0c4673a39f5fe6e643acb3bcf4ca22265 -R e846dae6bf0f685d3d72ee1ee9be47aa -U drh -Z 126048b893ad61b8f7402ec300895fff ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQFMdAqCoxKgR168RlERAtdlAJwIyEYLa9m+PygLDf3RUTuQe/66TACffSUE -yfKyQ4iSKXTFtQzDhfDQ3S8= -=PFf6 ------END PGP SIGNATURE----- +P 5e8101c5122336844ea920e6fbdace23e35b931f +R a696c1133501b0d7ad2be0304e78dcd5 +U shaneh +Z 80d9d8f470083fca9ed888138d87f8b3 diff --git a/manifest.uuid b/manifest.uuid index 8c0f36484c..61a354935f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5e8101c5122336844ea920e6fbdace23e35b931f \ No newline at end of file +d1ed743b6ed07ad0ee7d466932c5a83caa9489ee \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index f0b5b77544..60407b9f7e 100644 --- a/src/pager.c +++ b/src/pager.c @@ -2977,6 +2977,7 @@ static int pagerBeginReadTransaction(Pager *pPager){ return rc; } +#endif /* ** This function is called as part of the transition from PAGER_OPEN @@ -2998,7 +2999,11 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){ */ assert( pPager->eState==PAGER_OPEN ); assert( pPager->eLock>=SHARED_LOCK || pPager->noReadlock ); +#ifndef SQLITE_OMIT_WAL nPage = sqlite3WalDbsize(pPager->pWal); +#else + nPage = 0; +#endif /* If the database size was not available from the WAL sub-system, ** determine it based on the size of the database file. If the size @@ -3033,7 +3038,7 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){ return SQLITE_OK; } - +#ifndef SQLITE_OMIT_WAL /* ** Check if the *-wal file that corresponds to the database opened by pPager ** exists if the database is not empy, or verify that the *-wal file does @@ -4778,7 +4783,9 @@ int sqlite3PagerSharedLock(Pager *pPager){ ** mode. Otherwise, the following function call is a no-op. */ rc = pagerOpenWalIfPresent(pPager); +#ifndef SQLITE_OMIT_WAL assert( pPager->pWal==0 || rc==SQLITE_OK ); +#endif } if( pagerUseWal(pPager) ){ diff --git a/test/pager1.test b/test/pager1.test index 4eab17cf09..b09730d529 100644 --- a/test/pager1.test +++ b/test/pager1.test @@ -1919,32 +1919,34 @@ do_test pager1-20.2.2 { } } {} -do_test pager1-20.3.1 { - faultsim_delete_and_reopen - db func a_string a_string - execsql { - PRAGMA cache_size = 10; - PRAGMA journal_mode = wal; - BEGIN; - CREATE TABLE t1(x); - CREATE TABLE t2(y); - INSERT INTO t1 VALUES(a_string(800)); - INSERT INTO t1 SELECT a_string(800) FROM t1; /* 2 */ - INSERT INTO t1 SELECT a_string(800) FROM t1; /* 4 */ - INSERT INTO t1 SELECT a_string(800) FROM t1; /* 8 */ - INSERT INTO t1 SELECT a_string(800) FROM t1; /* 16 */ - INSERT INTO t1 SELECT a_string(800) FROM t1; /* 32 */ - COMMIT; - } -} {wal} -do_test pager1-20.3.2 { - execsql { - BEGIN; - INSERT INTO t2 VALUES('xxxx'); - } - recursive_select 32 t1 - execsql COMMIT -} {} +ifcapable wal { + do_test pager1-20.3.1 { + faultsim_delete_and_reopen + db func a_string a_string + execsql { + PRAGMA cache_size = 10; + PRAGMA journal_mode = wal; + BEGIN; + CREATE TABLE t1(x); + CREATE TABLE t2(y); + INSERT INTO t1 VALUES(a_string(800)); + INSERT INTO t1 SELECT a_string(800) FROM t1; /* 2 */ + INSERT INTO t1 SELECT a_string(800) FROM t1; /* 4 */ + INSERT INTO t1 SELECT a_string(800) FROM t1; /* 8 */ + INSERT INTO t1 SELECT a_string(800) FROM t1; /* 16 */ + INSERT INTO t1 SELECT a_string(800) FROM t1; /* 32 */ + COMMIT; + } + } {wal} + do_test pager1-20.3.2 { + execsql { + BEGIN; + INSERT INTO t2 VALUES('xxxx'); + } + recursive_select 32 t1 + execsql COMMIT + } {} +} #------------------------------------------------------------------------- # Test that a WAL database may not be opened if: @@ -1952,28 +1954,30 @@ do_test pager1-20.3.2 { # pager1-21.1.*: The VFS has an iVersion less than 2, or # pager1-21.2.*: The VFS does not provide xShmXXX() methods. # -do_test pager1-21.0 { - faultsim_delete_and_reopen - execsql { - PRAGMA journal_mode = WAL; - CREATE TABLE ko(c DEFAULT 'abc', b DEFAULT 'def'); - INSERT INTO ko DEFAULT VALUES; - } -} {wal} -do_test pager1-21.1 { - testvfs tv -noshm 1 - sqlite3 db2 test.db -vfs tv - catchsql { SELECT * FROM ko } db2 -} {1 {unable to open database file}} -db2 close -tv delete -do_test pager1-21.2 { - testvfs tv -iversion 1 - sqlite3 db2 test.db -vfs tv - catchsql { SELECT * FROM ko } db2 -} {1 {unable to open database file}} -db2 close -tv delete +ifcapable wal { + do_test pager1-21.0 { + faultsim_delete_and_reopen + execsql { + PRAGMA journal_mode = WAL; + CREATE TABLE ko(c DEFAULT 'abc', b DEFAULT 'def'); + INSERT INTO ko DEFAULT VALUES; + } + } {wal} + do_test pager1-21.1 { + testvfs tv -noshm 1 + sqlite3 db2 test.db -vfs tv + catchsql { SELECT * FROM ko } db2 + } {1 {unable to open database file}} + db2 close + tv delete + do_test pager1-21.2 { + testvfs tv -iversion 1 + sqlite3 db2 test.db -vfs tv + catchsql { SELECT * FROM ko } db2 + } {1 {unable to open database file}} + db2 close + tv delete +} #------------------------------------------------------------------------- # Test that a "PRAGMA wal_checkpoint": @@ -2254,24 +2258,26 @@ do_test pager1.27.1 { # the same database. # catch { db close } -do_multiclient_test tn { - do_test pager1-28.$tn.1 { - sql1 { - PRAGMA journal_mode = WAL; - CREATE TABLE t1(a, b); - INSERT INTO t1 VALUES('a', 'b'); - } - } {wal} - do_test pager1-28.$tn.2 { sql2 { SELECT * FROM t1 } } {a b} - - do_test pager1-28.$tn.3 { sql1 { PRAGMA locking_mode=exclusive } } {exclusive} - do_test pager1-28.$tn.4 { - csql1 { BEGIN; INSERT INTO t1 VALUES('c', 'd'); } - } {1 {database is locked}} - code2 { db2 close ; sqlite3 db2 test.db } - do_test pager1-28.$tn.4 { - sql1 { INSERT INTO t1 VALUES('c', 'd'); COMMIT } - } {} +ifcapable wal { + do_multiclient_test tn { + do_test pager1-28.$tn.1 { + sql1 { + PRAGMA journal_mode = WAL; + CREATE TABLE t1(a, b); + INSERT INTO t1 VALUES('a', 'b'); + } + } {wal} + do_test pager1-28.$tn.2 { sql2 { SELECT * FROM t1 } } {a b} + + do_test pager1-28.$tn.3 { sql1 { PRAGMA locking_mode=exclusive } } {exclusive} + do_test pager1-28.$tn.4 { + csql1 { BEGIN; INSERT INTO t1 VALUES('c', 'd'); } + } {1 {database is locked}} + code2 { db2 close ; sqlite3 db2 test.db } + do_test pager1-28.$tn.4 { + sql1 { INSERT INTO t1 VALUES('c', 'd'); COMMIT } + } {} + } } #------------------------------------------------------------------------- diff --git a/test/stat.test b/test/stat.test index 177da0a40a..06e97792df 100644 --- a/test/stat.test +++ b/test/stat.test @@ -30,11 +30,14 @@ do_execsql_test stat-0.0 { CREATE VIRTUAL TABLE temp.stat USING dbstat; SELECT * FROM stat; } {} -do_execsql_test stat-0.1 { - PRAGMA journal_mode = WAL; - PRAGMA journal_mode = delete; - SELECT * FROM stat; -} {wal delete sqlite_master / 1 leaf 0 0 916 0} + +ifcapable wal { + do_execsql_test stat-0.1 { + PRAGMA journal_mode = WAL; + PRAGMA journal_mode = delete; + SELECT * FROM stat; + } {wal delete sqlite_master / 1 leaf 0 0 916 0} +} do_test stat-1.0 { execsql { diff --git a/test/walshared.test b/test/walshared.test index 658a25f9e1..73a3fb8bc1 100644 --- a/test/walshared.test +++ b/test/walshared.test @@ -15,6 +15,9 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl + +ifcapable !wal {finish_test ; return } + db close set ::enable_shared_cache [sqlite3_enable_shared_cache 1]