Fix an assert in pager.c. And various test cases that fail with the in-memory journal permutation.

FossilOrigin-Name: 78fc35ff4b01d4a583009ec8b8bf876738ca7b92
This commit is contained in:
dan 2010-07-03 13:45:52 +00:00
parent 40e459e041
commit 3f94b60961
6 changed files with 64 additions and 26 deletions

View File

@ -1,8 +1,5 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Remove\scode\saccidently\sappended\sto\spager.c.
D 2010-07-03T12:26:33
C Fix\san\sassert\sin\spager.c.\sAnd\svarious\stest\scases\sthat\sfail\swith\sthe\sin-memory\sjournal\spermutation.
D 2010-07-03T13:45:53
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -159,7 +156,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
F src/os_unix.c d7910391a4c9fa6898f7c9abbbb821d5d7edb78f
F src/os_win.c dd4c6f238fe464e01dab5e4bc9158187ae305fe8
F src/pager.c eee7ac31ce893ed6b7e28f907fe99144c0696953
F src/pager.c e4470e43f0fefe5f81034efb706a2b1f4db5ca41
F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c
F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
@ -470,7 +467,7 @@ F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe
F test/join6.test bf82cf3f979e9eade83ad0d056a66c5ed71d1901
F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
F test/journal2.test a08ea6545d987385e7cbb1d4e7dc2eaacd83b00b
F test/jrnlmode.test 76f94d61528c5ff32102a12f8cf34f4cc36f7849
F test/jrnlmode.test 17881937be86841ad80431699222bf84aa01172a
F test/jrnlmode2.test a19e28de1a6ec898067e46a122f1b71c9323bf00
F test/jrnlmode3.test cfcdb12b90e640a23b92785a002d96c0624c8710
F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05
@ -538,7 +535,7 @@ F test/notify3.test feb03d697f4a5327c1beb158c3e7e51c5e400703
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
F test/pager1.test b345014ce33efcc28a8810c476090068b279ee30
F test/pager1.test 1fc67606e4c2e9cef17aa0c6f6fceae0fffaa9f3
F test/pager2.test f5c757c271ce642d36a393ecbfb3aef1c240dcef
F test/pagerfault.test 17e51d1570c00df4a1902e6d500387017c87e74a
F test/pagerfault2.test 2d2d4373b1365d693ba185323d0766feeacdb4dd
@ -787,7 +784,7 @@ F test/walcrash.test f6d5fb2bb108876f04848720a488065d9deef69f
F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
F test/walfault.test c2b524299dede269282a0795e11396cc446ca9af
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
F test/walmode.test b54e2f91f34179c65cab02a6916578617a33eef0
F test/walmode.test cfca1207d725fb5bc25b3b9f9a7053c0277cad4a
F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933
F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c
F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
@ -833,14 +830,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 6d7640edcd69a932556f86500aedbf14e75ba7de
R d0b007e2ef9688923f10274954448b62
U drh
Z be2fc7329c7e3b5fca1a0eb4a8d0cff8
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMLyx8oxKgR168RlERAkl1AJ4ohtqY31ahBbiC1mts0x8F0P605ACcC9FU
hIo83ZyxiUs6yqlF5ffrsAg=
=NNUf
-----END PGP SIGNATURE-----
P 7cbe175a69738499f9218ec56f1a39f040aea9dc
R c5e0f625cc36dd57b9413db473409eda
U dan
Z 7660b7f8316180874f8f1a941691e23e

View File

@ -1 +1 @@
7cbe175a69738499f9218ec56f1a39f040aea9dc
78fc35ff4b01d4a583009ec8b8bf876738ca7b92

View File

@ -5165,7 +5165,10 @@ int sqlite3PagerCommitPhaseOne(
*/
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
PgHdr *pPg;
assert( isOpen(pPager->jfd) || pPager->journalMode==PAGER_JOURNALMODE_OFF );
assert( isOpen(pPager->jfd)
|| pPager->journalMode==PAGER_JOURNALMODE_OFF
|| pPager->journalMode==PAGER_JOURNALMODE_WAL
);
if( !zMaster && isOpen(pPager->jfd)
&& pPager->journalOff==jrnlBufferSize(pPager)
&& pPager->dbSize>=pPager->dbFileSize

View File

@ -504,4 +504,20 @@ ifcapable pragma {
}
}
ifcapable pragma {
catch { db close }
do_test jrnlmode-7.1 {
foreach f [glob -nocomplain test.db*] { file delete -force $f }
sqlite3 db test.db
execsql {
PRAGMA journal_mode = memory;
PRAGMA auto_vacuum = 0;
PRAGMA page_size = 1024;
PRAGMA user_version = 5;
PRAGMA user_version;
}
} {memory 5}
do_test jrnlmode-7.2 { file size test.db } {1024}
}
finish_test

View File

@ -559,20 +559,24 @@ foreach {tn1 tcl} {
o {
PRAGMA main.synchronous=OFF;
PRAGMA aux.synchronous=OFF;
PRAGMA journal_mode = DELETE;
}
o512 {
PRAGMA main.synchronous=OFF;
PRAGMA aux.synchronous=OFF;
PRAGMA main.page_size = 512;
PRAGMA aux.page_size = 512;
PRAGMA journal_mode = DELETE;
}
n {
PRAGMA main.synchronous=NORMAL;
PRAGMA aux.synchronous=NORMAL;
PRAGMA journal_mode = DELETE;
}
f {
PRAGMA main.synchronous=FULL;
PRAGMA aux.synchronous=FULL;
PRAGMA journal_mode = DELETE;
}
} {
@ -665,6 +669,7 @@ proc copy_on_journal_delete {method filename args} {
}
faultsim_delete_and_reopen
do_execsql_test pager1.4.5.1 {
PRAGMA journal_mode = DELETE;
PRAGMA page_size = 1024;
CREATE TABLE t1(a, b);
CREATE TABLE t2(a, b);
@ -674,7 +679,7 @@ do_execsql_test pager1.4.5.1 {
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t2 VALUES(3, 4);
COMMIT;
} {}
} {delete}
tv filter {}
# Check the transaction was committed:
@ -742,6 +747,7 @@ proc copy_on_mj_delete {method filename args} {
do_test pager1.4.6.1 {
faultsim_delete_and_reopen
execsql {
PRAGMA journal_mode = DELETE;
ATTACH 'test.db2' AS two;
CREATE TABLE t1(a, b);
CREATE TABLE two.t2(a, b);
@ -772,6 +778,7 @@ do_test pager1.4.6.8 {
tv filter xDelete
sqlite3 db test.db2
execsql {
PRAGMA journal_mode = DELETE;
ATTACH 'test.db3' AS three;
CREATE TABLE three.t3(a, b);
INSERT INTO t3 VALUES(1, 't3.1');
@ -839,6 +846,7 @@ proc copy_on_journal_delete {method filename args} {
}
faultsim_delete_and_reopen
do_execsql_test pager1.4.7.1 {
PRAGMA journal_mode = DELETE;
CREATE TABLE t1(x PRIMARY KEY, y);
CREATE INDEX i1 ON t1(y);
INSERT INTO t1 VALUES('I', 'one');
@ -848,7 +856,7 @@ do_execsql_test pager1.4.7.1 {
INSERT INTO t1 VALUES('IV', 'sixteen');
INSERT INTO t1 VALUES('V' , 'twentyfive');
COMMIT;
} {}
} {delete}
tv filter {}
db close
tv delete
@ -1339,7 +1347,6 @@ foreach sectorsize {
DROP TABLE t6;
DROP TABLE t7;
}
if {$eff==65536} breakpoint
execsql {
BEGIN;
CREATE TABLE t6(a, b);
@ -1393,6 +1400,7 @@ testvfs tv -default 1
faultsim_delete_and_reopen
db func a_string a_string
do_execsql_test pager1-11.1 {
PRAGMA journal_mode = DELETE;
PRAGMA cache_size = 10;
BEGIN;
CREATE TABLE zz(top PRIMARY KEY);
@ -1405,7 +1413,7 @@ do_execsql_test pager1-11.1 {
COMMIT;
BEGIN;
UPDATE zz SET top = a_string(345);
} {}
} {delete}
proc lockout {method args} { return SQLITE_IOERR }
tv script lockout

View File

@ -15,6 +15,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
# If the library was compiled without WAL support, check that the
# "PRAGMA journal_mode=WAL" treats "WAL" as an unrecognized mode.
@ -267,4 +268,24 @@ do_test walmode-5.3.5 {
}
} [list 1 2 3 4 $tempJrnlMode]
#-------------------------------------------------------------------------
# Test changing to WAL mode from journal_mode=off or journal_mode=memory
#
foreach {tn mode} {
3 persist
4 delete
5 truncate
2 memory
1 off
} {
do_test walmode-6.$tn {
faultsim_delete_and_reopen
execsql "
PRAGMA journal_mode = $mode;
PRAGMA journal_mode = wal;
"
} [list $mode wal]
}
finish_test