When synchronous=NORMAL, use the same journal file format as with synchronous=FULL (i.e. multiple journal headers within the one journal). Fix for [d11f09d36e].
FossilOrigin-Name: 2eaf5ee0d9338de8a77fb3e06ad2f2b0daa6fcbe
This commit is contained in:
parent
f9b4419d39
commit
273f3f0d1a
19
manifest
19
manifest
@ -1,5 +1,5 @@
|
||||
C Further\stest\scases\sfor\spager1.test\sand\spagerfault.test.
|
||||
D 2010-06-25T19:09:48
|
||||
C When\ssynchronous=NORMAL,\suse\sthe\ssame\sjournal\sfile\sformat\sas\swith\ssynchronous=FULL\s(i.e.\smultiple\sjournal\sheaders\swithin\sthe\sone\sjournal).\sFix\sfor\s[d11f09d36e].
|
||||
D 2010-06-26T15:42:34
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -156,7 +156,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
|
||||
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
|
||||
F src/os_unix.c 4b03e5a8a353b51af64ba11ffec85160818b4d89
|
||||
F src/os_win.c 48f67798969ba983487fed5691059ade7fff2ef7
|
||||
F src/pager.c edf1f8b02b5c106bd3a3add0d06f28859195a0f8
|
||||
F src/pager.c db0de9e04795c43a5fbedb0472a78421d295a2e2
|
||||
F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c
|
||||
F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
|
||||
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
|
||||
@ -534,14 +534,15 @@ F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db
|
||||
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
|
||||
F test/null.test a8b09b8ed87852742343b33441a9240022108993
|
||||
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
|
||||
F test/pager1.test dfb695c91652559302530319cccb608c4ed23a59
|
||||
F test/pager1.test 18d3546658573ed7fffd32f482f7447f814f16d7
|
||||
F test/pager2.test f5c757c271ce642d36a393ecbfb3aef1c240dcef
|
||||
F test/pagerfault.test d90859967eda59b53074498846d142a81d7e29ff
|
||||
F test/pagerfault.test a6b0ef0f9e678aea5a649c78efee284516abaf83
|
||||
F test/pagerfault2.test 1287f123bd5d20452113739ed7755fd254e502f1
|
||||
F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
|
||||
F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb
|
||||
F test/pcache.test 4118a183908ecaed343a06fcef3ba82e87e0129d
|
||||
F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16
|
||||
F test/permutations.test 708a2e3ac5451c45189546a5f3814937ca2aab97
|
||||
F test/permutations.test 81d93c4650073c332f9e4406e4b5d1e7f52c097f
|
||||
F test/pragma.test a869b428b861f9dbbdb25461a104e8e830fc3026
|
||||
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
|
||||
F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea
|
||||
@ -825,7 +826,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P 4a7fd91b7ab2c5d21fbac7f6f123820c8f4ec7f6
|
||||
R ecb04b890fe63f676fa227ca5f46f9c3
|
||||
P bfd563c4714d86805fa09ce9f4f807e5d502a99b
|
||||
R 62f97e4de0e91c38030c931babbba997
|
||||
U dan
|
||||
Z 46acbd8eac91574d70d09df9d19b8578
|
||||
Z 9480f3d1537574931a028c718842710f
|
||||
|
@ -1 +1 @@
|
||||
bfd563c4714d86805fa09ce9f4f807e5d502a99b
|
||||
2eaf5ee0d9338de8a77fb3e06ad2f2b0daa6fcbe
|
@ -3550,8 +3550,9 @@ static int pagerStress(void *p, PgHdr *pPg){
|
||||
|
||||
/* Sync the journal file if required. */
|
||||
if( pPg->flags&PGHDR_NEED_SYNC ){
|
||||
assert( !pPager->noSync );
|
||||
rc = syncJournal(pPager);
|
||||
if( rc==SQLITE_OK && pPager->fullSync &&
|
||||
if( rc==SQLITE_OK &&
|
||||
!(pPager->journalMode==PAGER_JOURNALMODE_MEMORY) &&
|
||||
!(sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND)
|
||||
){
|
||||
|
@ -194,6 +194,9 @@ do_multiclient_test tn {
|
||||
#
|
||||
# pager1-3.1.2.*: Force a savepoint rollback to cause the database file
|
||||
# to grow.
|
||||
#
|
||||
# pager1-3.1.3.*: Use a journal created in synchronous=off mode as part
|
||||
# of a savepoint rollback.
|
||||
#
|
||||
do_test pager1-3.1.1 {
|
||||
faultsim_delete_and_reopen
|
||||
@ -228,38 +231,75 @@ do_execsql_test pager1-3.4 { SELECT * FROM counter } {3 0}
|
||||
do_execsql_test pager1-3.5 { SELECT a FROM t1 } {1 2 3}
|
||||
do_execsql_test pager1-3.6 { COMMIT } {}
|
||||
|
||||
do_test pager1-3.2.1 {
|
||||
faultsim_delete_and_reopen
|
||||
db func a_string a_string
|
||||
execsql {
|
||||
PRAGMA auto_vacuum = 2;
|
||||
PRAGMA cache_size = 10;
|
||||
CREATE TABLE z(x INTEGER PRIMARY KEY, y);
|
||||
foreach {tn sql tcl} {
|
||||
9 { PRAGMA synchronous = NORMAL } { }
|
||||
|
||||
7 { PRAGMA synchronous = NORMAL } {
|
||||
testvfs tv -default 1
|
||||
tv devchar safe_append
|
||||
}
|
||||
8 { PRAGMA synchronous = FULL } { }
|
||||
10 { PRAGMA synchronous = OFF } { }
|
||||
11 { PRAGMA synchronous = FULL ; PRAGMA fullfsync = 1 } { }
|
||||
} {
|
||||
do_test pager1-3.$tn.1 {
|
||||
eval $tcl
|
||||
faultsim_delete_and_reopen
|
||||
db func a_string a_string
|
||||
execsql $sql
|
||||
execsql {
|
||||
PRAGMA auto_vacuum = 2;
|
||||
PRAGMA cache_size = 10;
|
||||
CREATE TABLE z(x INTEGER PRIMARY KEY, y);
|
||||
BEGIN;
|
||||
INSERT INTO z VALUES(NULL, a_string(800));
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 2
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 4
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 8
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 16
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 32
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 64
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 128
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 256
|
||||
COMMIT;
|
||||
}
|
||||
execsql { PRAGMA auto_vacuum }
|
||||
} {2}
|
||||
do_execsql_test pager1-3.$tn.2 {
|
||||
BEGIN;
|
||||
INSERT INTO z VALUES(NULL, a_string(800));
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 2
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 4
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 8
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 16
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 32
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 64
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 128
|
||||
INSERT INTO z SELECT NULL, a_string(800) FROM z; -- 256
|
||||
INSERT INTO z VALUES(NULL, a_string(800));
|
||||
SAVEPOINT one;
|
||||
UPDATE z SET y = NULL WHERE x>256;
|
||||
PRAGMA incremental_vacuum;
|
||||
SELECT count(*) FROM z WHERE x < 100;
|
||||
ROLLBACK TO one;
|
||||
COMMIT;
|
||||
}
|
||||
execsql { PRAGMA auto_vacuum }
|
||||
} {2}
|
||||
do_execsql_test pager1-3.2.2 {
|
||||
BEGIN;
|
||||
INSERT INTO z VALUES(NULL, a_string(800));
|
||||
INSERT INTO z VALUES(NULL, a_string(800));
|
||||
} {99}
|
||||
|
||||
do_execsql_test pager1-3.$tn.3 {
|
||||
BEGIN;
|
||||
SAVEPOINT one;
|
||||
UPDATE z SET y = y||x;
|
||||
ROLLBACK TO one;
|
||||
COMMIT;
|
||||
SELECT count(*) FROM z;
|
||||
} {258}
|
||||
|
||||
do_execsql_test pager1-3.$tn.4 {
|
||||
SAVEPOINT one;
|
||||
DELETE FROM z WHERE x>256;
|
||||
PRAGMA incremental_vacuum;
|
||||
SELECT count(*) FROM z WHERE x < 100;
|
||||
UPDATE z SET y = y||x;
|
||||
ROLLBACK TO one;
|
||||
COMMIT;
|
||||
} {99}
|
||||
} {}
|
||||
do_execsql_test pager1-3.$tn.5 {
|
||||
SELECT count(*) FROM z;
|
||||
RELEASE one;
|
||||
PRAGMA integrity_check;
|
||||
} {258 ok}
|
||||
|
||||
db close
|
||||
catch { tv delete }
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Hot journal rollback related test cases.
|
||||
|
@ -23,6 +23,8 @@ proc a_string {n} {
|
||||
}
|
||||
db func a_string a_string
|
||||
|
||||
if 1 {
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test fault-injection while rolling back a hot-journal file.
|
||||
#
|
||||
@ -421,6 +423,12 @@ do_faultsim_test pagerfault-8 -prep {
|
||||
faultsim_integrity_check
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# This test case is specially designed so that during a savepoint
|
||||
# rollback, a new cache entry must be allocated (see comments surrounding
|
||||
# the call to sqlite3PagerAcquire() from within pager_playback_one_page()
|
||||
# for details). Test the effects of injecting an OOM at this point.
|
||||
#
|
||||
do_test pagerfault-9-pre1 {
|
||||
faultsim_delete_and_reopen
|
||||
execsql {
|
||||
@ -435,8 +443,7 @@ do_test pagerfault-9-pre1 {
|
||||
}
|
||||
faultsim_save_and_close
|
||||
} {}
|
||||
|
||||
do_faultsim_test pagerfault-9 -prep {
|
||||
do_faultsim_test pagerfault-9.1 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql {
|
||||
BEGIN;
|
||||
@ -463,4 +470,79 @@ do_faultsim_test pagerfault-9 -prep {
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test fault injection with a temporary database file.
|
||||
#
|
||||
do_faultsim_test pagerfault-10 -prep {
|
||||
sqlite3 db ""
|
||||
db func a_string a_string;
|
||||
execsql {
|
||||
PRAGMA cache_size = 10;
|
||||
BEGIN;
|
||||
CREATE TABLE xx(a, b, UNIQUE(a, b));
|
||||
INSERT INTO xx VALUES(a_string(200), a_string(200));
|
||||
INSERT INTO xx SELECT a_string(200), a_string(200) FROM xx;
|
||||
INSERT INTO xx SELECT a_string(200), a_string(200) FROM xx;
|
||||
INSERT INTO xx SELECT a_string(200), a_string(200) FROM xx;
|
||||
INSERT INTO xx SELECT a_string(200), a_string(200) FROM xx;
|
||||
COMMIT;
|
||||
}
|
||||
} -body {
|
||||
execsql { UPDATE xx SET a = a_string(300) }
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
faultsim_integrity_check
|
||||
faultsim_integrity_check
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test fault injection with transaction savepoints (savepoints created
|
||||
# when a SAVEPOINT command is executed outside of any other savepoint
|
||||
# or transaction context).
|
||||
#
|
||||
do_test pagerfault-9-pre1 {
|
||||
faultsim_delete_and_reopen
|
||||
db func a_string a_string;
|
||||
execsql {
|
||||
PRAGMA auto_vacuum = on;
|
||||
CREATE TABLE t1(x UNIQUE);
|
||||
CREATE TABLE t2(y UNIQUE);
|
||||
CREATE TABLE t3(z UNIQUE);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(a_string(202));
|
||||
INSERT INTO t2 VALUES(a_string(203));
|
||||
INSERT INTO t3 VALUES(a_string(204));
|
||||
INSERT INTO t1 SELECT a_string(202) FROM t1;
|
||||
INSERT INTO t1 SELECT a_string(203) FROM t1;
|
||||
INSERT INTO t1 SELECT a_string(204) FROM t1;
|
||||
INSERT INTO t1 SELECT a_string(205) FROM t1;
|
||||
INSERT INTO t2 SELECT a_string(length(x)) FROM t1;
|
||||
INSERT INTO t3 SELECT a_string(length(x)) FROM t1;
|
||||
COMMIT;
|
||||
}
|
||||
faultsim_save_and_close
|
||||
} {}
|
||||
do_faultsim_test pagerfault-11 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql { PRAGMA cache_size = 10 }
|
||||
} -body {
|
||||
execsql {
|
||||
SAVEPOINT trans;
|
||||
UPDATE t2 SET y = y||'2';
|
||||
INSERT INTO t3 SELECT * FROM t2;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK TO trans;
|
||||
UPDATE t1 SET x = x||'3';
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
DELETE FROM t3;
|
||||
RELEASE trans;
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
faultsim_integrity_check
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
66
test/pagerfault2.test
Normal file
66
test/pagerfault2.test
Normal file
@ -0,0 +1,66 @@
|
||||
# 2010 June 15
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# The tests in this file test the pager modules response to various
|
||||
# fault conditions (OOM, IO error, disk full etc.). They are similar
|
||||
# to those in file pagerfault1.test.
|
||||
#
|
||||
# More specifically, the tests in this file are those deemed too slow to
|
||||
# run as part of pagerfault1.test.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
|
||||
set a_string_counter 1
|
||||
proc a_string {n} {
|
||||
global a_string_counter
|
||||
incr a_string_counter
|
||||
string range [string repeat "${a_string_counter}." $n] 1 $n
|
||||
}
|
||||
db func a_string a_string
|
||||
|
||||
|
||||
# The following tests, pagerfault2-1.*, attempt to provoke OOM errors when
|
||||
# manipulating the internal "bitvec" structures. Since bitvec structures
|
||||
# only allocate memory very rarely, this requires fairly large databases.
|
||||
#
|
||||
do_test pagerfault2-1-pre1 {
|
||||
faultsim_delete_and_reopen
|
||||
db func a_string a_string
|
||||
execsql {
|
||||
PRAGMA journal_mode = DELETE;
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(a_string(401), a_string(402));
|
||||
}
|
||||
for {set ii 0} {$ii < 14} {incr ii} {
|
||||
execsql { INSERT INTO t1 SELECT a_string(401), a_string(402) FROM t1 }
|
||||
}
|
||||
faultsim_save_and_close
|
||||
} {}
|
||||
do_faultsim_test pagerfault2-1.1 -faults oom* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(5, 6);
|
||||
SAVEPOINT abc;
|
||||
UPDATE t1 SET a = a||'x';
|
||||
}
|
||||
} -body {
|
||||
execsql { ROLLBACK TO abc }
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
faultsim_integrity_check
|
||||
}
|
||||
|
||||
finish_test
|
@ -98,14 +98,14 @@ set allquicktests [test_set $alltests -exclude {
|
||||
corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test
|
||||
crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test
|
||||
fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test
|
||||
misc7.test mutex2.test notify2.test onefile.test
|
||||
misc7.test mutex2.test notify2.test onefile.test pagerfault2.test
|
||||
savepoint4.test savepoint6.test select9.test
|
||||
speed1.test speed1p.test speed2.test speed3.test speed4.test
|
||||
speed4p.test sqllimits1.test tkt2686.test thread001.test thread002.test
|
||||
thread003.test thread004.test thread005.test trans2.test vacuum3.test
|
||||
incrvacuum_ioerr.test autovacuum_crash.test btree8.test shared_err.test
|
||||
vtab_err.test walslow.test walcrash.test
|
||||
walthread.test
|
||||
walthread.test
|
||||
}]
|
||||
|
||||
#############################################################################
|
||||
@ -161,7 +161,7 @@ test_suite "coverage-wal" -description {
|
||||
Coverage tests for file wal.c.
|
||||
} -files {
|
||||
wal.test wal2.test wal3.test walmode.test
|
||||
walbak.test walhook.test walcrash2.test walcksum.test
|
||||
walbak.test walhook.test walcrash2.test walcksum.test
|
||||
walfault.test
|
||||
}
|
||||
|
||||
@ -171,6 +171,8 @@ test_suite "coverage-pager" -description {
|
||||
pager1.test
|
||||
pager2.test
|
||||
pagerfault.test
|
||||
walfault.test
|
||||
walbak.test
|
||||
journal2.test
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user