Add a test case to waloverwrite.test to check that savepoint rollback does not cause a problem.
FossilOrigin-Name: 87dae56c322454094d445e474ae36a4f464272a4
This commit is contained in:
parent
8997087a00
commit
c3bd870f09
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Improved\stestability.
|
||||
D 2016-01-11T00:52:32.218
|
||||
C Add\sa\stest\scase\sto\swaloverwrite.test\sto\scheck\sthat\ssavepoint\srollback\sdoes\snot\scause\sa\sproblem.
|
||||
D 2016-01-11T08:12:40.471
|
||||
F Makefile.in 7c8cc4c2f0179efc6fa9492141d1fb65f4807054
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc e45d8b9b56dfa3f2cd860b2c28bd9d304513b042
|
||||
@ -1301,7 +1301,7 @@ F test/walfault.test 1f8389f7709877e9b4cc679033d71d6fe529056b
|
||||
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
|
||||
F test/walmode.test 4022fe03ae6e830583672caa101f046438a0473c
|
||||
F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496
|
||||
F test/waloverwrite.test 59476a2cf0638a057ced738b62dc719ed4e32e53
|
||||
F test/waloverwrite.test 8702964967c2f28204f0b4f27af65da81999fc99
|
||||
F test/walpersist.test 8c6b7e3ec1ba91b5e4dc4e0921d6d3f87cd356a6
|
||||
F test/walro.test 34422d1d95aaff0388f0791ec20edb34e2a3ed57
|
||||
F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417
|
||||
@ -1407,7 +1407,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 99b31a6b491c1c51227f478d3713b020d37a17cf
|
||||
R d76e78fad37168874a95f2cf1af1f963
|
||||
U drh
|
||||
Z b9a236105d87275bc956baaa16673a98
|
||||
P e83d3a2a4e06665e8a056f63063bd6df03f063b9
|
||||
R 328bc4f1800dd81a2ef2edb5973d61be
|
||||
U dan
|
||||
Z 271430cf4c8b2d1a2970f55a9b9d9220
|
||||
|
@ -1 +1 @@
|
||||
e83d3a2a4e06665e8a056f63063bd6df03f063b9
|
||||
87dae56c322454094d445e474ae36a4f464272a4
|
@ -22,18 +22,28 @@ ifcapable !wal {finish_test ; return }
|
||||
|
||||
# Simple test:
|
||||
#
|
||||
# 1. Create a database of blobs roughly 50 pages in size.
|
||||
# Test cases *.1 - *.6:
|
||||
#
|
||||
# 2. Set the db cache size to something much smaller than this (5 pages)
|
||||
# + Create a database of blobs roughly 50 pages in size.
|
||||
#
|
||||
# 3. Within a transaction, loop through the set of blobs 5 times. Update
|
||||
# + Set the db cache size to something much smaller than this (5 pages)
|
||||
#
|
||||
# + Within a transaction, loop through the set of blobs 5 times. Update
|
||||
# each blob as it is visited.
|
||||
#
|
||||
# 4. Test that the wal file is roughly 50 pages in size - even though many
|
||||
# + Test that the wal file is roughly 50 pages in size - even though many
|
||||
# database pages have been written to it multiple times.
|
||||
#
|
||||
# 5. Take a copy of the database and wal file. Test that recovery can
|
||||
# be run on it.
|
||||
# + Take a copy of the database and wal file. Test that recovery can
|
||||
# be run on it.
|
||||
#
|
||||
# Test cases *.7 - *.9:
|
||||
#
|
||||
# + Same thing, but before committing the statement transaction open
|
||||
# a SAVEPOINT, update the blobs another 5 times, then roll it back.
|
||||
#
|
||||
# + Check that if recovery is run on the resulting wal file, the rolled
|
||||
# back changes from within the SAVEPOINT are not present in the db.
|
||||
#
|
||||
# The above is run twice - once where the wal file is empty at the start of
|
||||
# step 3 (tn==1) and once where it already contains a transaction (tn==2).
|
||||
@ -45,6 +55,7 @@ foreach {tn xtra} {
|
||||
reset_db
|
||||
do_execsql_test 1.$tn.0 {
|
||||
CREATE TABLE t1(x, y);
|
||||
CREATE TABLE t2(x, y);
|
||||
CREATE INDEX i1y ON t1(y);
|
||||
|
||||
WITH cnt(i) AS (
|
||||
@ -98,6 +109,55 @@ foreach {tn xtra} {
|
||||
do_test 1.$tn.6 {
|
||||
execsql { PRAGMA integrity_check } db2
|
||||
} ok
|
||||
db2 close
|
||||
|
||||
do_test 1.$tn.7 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
db transaction {
|
||||
for {set i 0} {$i < 1} {incr i} {
|
||||
foreach x [db eval {SELECT x FROM t1}] {
|
||||
execsql { UPDATE t1 SET y = randomblob(798) WHERE x=$x }
|
||||
}
|
||||
}
|
||||
|
||||
execsql {
|
||||
WITH cnt(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM cnt WHERE i<20)
|
||||
INSERT INTO t2 SELECT i, randomblob(800) FROM cnt;
|
||||
}
|
||||
|
||||
execsql {SAVEPOINT abc}
|
||||
for {set i 0} {$i < 5} {incr i} {
|
||||
foreach x [db eval {SELECT x FROM t1}] {
|
||||
execsql { UPDATE t1 SET y = randomblob(797) WHERE x=$x }
|
||||
}
|
||||
}
|
||||
breakpoint
|
||||
execsql {ROLLBACK TO abc}
|
||||
|
||||
}
|
||||
|
||||
set nPg [wal_frame_count test.db-wal 1024]
|
||||
expr $nPg>55 && $nPg<75
|
||||
} {1}
|
||||
|
||||
do_test 1.$tn.8 {
|
||||
forcedelete test.db2 test.db2-wal
|
||||
forcecopy test.db test.db2
|
||||
sqlite3 db2 test.db2
|
||||
execsql { SELECT sum(length(y)) FROM t1 } db2
|
||||
} [expr 20*799]
|
||||
|
||||
do_test 1.$tn.9 {
|
||||
db2 close
|
||||
forcecopy test.db-wal test.db2-wal
|
||||
sqlite3 db2 test.db2
|
||||
execsql { SELECT sum(length(y)) FROM t1 } db2
|
||||
} [expr 20*798]
|
||||
|
||||
do_test 1.$tn.9 {
|
||||
execsql { PRAGMA integrity_check } db2
|
||||
} ok
|
||||
db2 close
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user