Add a test to check that a checkpointer releases its locks before returning, even if it has been prevented by a conflicting lock from checkpointing the database.

Add a test to check that a checkpointer releases its locks before returning, even if it has been prevented by a conflicting lock from checkpointing the database.

FossilOrigin-Name: be44349d2b790fb470fcc9fb6a12e8b1076dc645
This commit is contained in:
dan 2010-04-27 18:43:16 +00:00
parent 8b5444bfae
commit 8b348af860
3 changed files with 35 additions and 7 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\sproblem\swith\sidentifying\sa\scorrupt\sdatabase\sin\sWAL\smode.
D 2010-04-27T14:37:48
C Add\sa\stest\sto\scheck\sthat\sa\scheckpointer\sreleases\sits\slocks\sbefore\sreturning,\seven\sif\sit\shas\sbeen\sprevented\sby\sa\sconflicting\slock\sfrom\scheckpointing\sthe\sdatabase.\nAdd\sa\stest\sto\scheck\sthat\sa\scheckpointer\sreleases\sits\slocks\sbefore\sreturning,\seven\sif\sit\shas\sbeen\sprevented\sby\sa\sconflicting\slock\sfrom\scheckpointing\sthe\sdatabase.
D 2010-04-27T18:43:17
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -758,7 +758,7 @@ F test/vtabE.test 7c4693638d7797ce2eda17af74292b97e705cc61
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
F test/wal.test fbf7a911b35eb9b09a84eee4020e9e4c8b148d6f
F test/wal.test bc99b1656b721fddd2dfeea0b0e77b147e40e6da
F test/walbak.test f6fde9a5f59d0c697cb1f4af7876178c2f69a7ba
F test/walcrash.test f022cee7eb7baa5fb898726120a6a4073dd831d1
F test/walhook.test 76a559e262f0715c470bade4a8d8333035f8ee47
@ -808,7 +808,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P c8893310510148f7e71ede5691606b6fc1c3df4d
R f19cde4cc4d379e9990f915e41f267c6
P c8658da44671e9c43c90ee4857bbe82c55d40f25
R a5a18287a7b1df82858844e5aea7a99d
U dan
Z cdf65bfac6e74e44b7b865cbe4482fc0
Z 295004ae7ba64e99842190f4e410241f

View File

@ -1 +1 @@
c8658da44671e9c43c90ee4857bbe82c55d40f25
be44349d2b790fb470fcc9fb6a12e8b1076dc645

View File

@ -666,6 +666,34 @@ foreach code [list {
execsql { SELECT * FROM t1 }
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22}
# Test that if a checkpointer cannot obtain the required locks, it
# releases all locks before returning a busy error.
#
do_test wal-10.$tn.35 {
execsql {
DELETE FROM t1;
INSERT INTO t1 VALUES('a', 'b');
INSERT INTO t1 VALUES('c', 'd');
}
sql2 {
BEGIN;
SELECT * FROM t1;
}
} {a b c d}
proc busyhandler x { return 1 }
db busy busyhandler
do_test wal-10.$tn.36 {
catchsql { PRAGMA checkpoint }
} {1 {database is locked}}
do_test wal-10.$tn.36 {
sql3 { INSERT INTO t1 VALUES('e', 'f') }
sql2 { SELECT * FROM t1 }
} {a b c d}
do_test wal-10.$tn.37 {
sql2 COMMIT
execsql { PRAGMA checkpoint }
} {}
catch { db close }
catch { code2 { db2 close } }
catch { code3 { db3 close } }