Add a test to ensure that "PRAGMA wal_checkpoint = FULL" invokes the busy-handler to wait on read-locks.
FossilOrigin-Name: f068fb116286b1dbdee9c168900348cfcab84e6d8413f3456e4e492f650d11b0
This commit is contained in:
parent
f488bc1147
commit
3f1d0f56e4
12
manifest
12
manifest
@ -1,6 +1,6 @@
|
||||
B 7a876209a678a34c198b54ceef9e3c041f128a14dc73357f6a57cadadaa6cf7b
|
||||
C Avoid\sa\spotential\sbuffer\soverread\sin\sfts3\swhen\sprocessing\scorrupt\srecords.
|
||||
D 2020-06-30T15:32:12.803
|
||||
C Add\sa\stest\sto\sensure\sthat\s"PRAGMA\swal_checkpoint\s=\sFULL"\sinvokes\sthe\sbusy-handler\sto\swait\son\sread-locks.
|
||||
D 2020-06-30T18:21:45.061
|
||||
F Makefile.in 19374a5db06c3199ec1bab71ab74a103d8abf21053c05e9389255dc58083f806
|
||||
F Makefile.msc 48f5a3fc32672c09ad73795749f6253e406a31526935fbbffd8f021108d54574
|
||||
F autoconf/Makefile.am a8d1d24affe52ebf8d7ddcf91aa973fa0316618ab95bb68c87cabf8faf527dc8
|
||||
@ -21,7 +21,7 @@ F src/test1.c fe56c4bcaa2685ca9aa25d817a0ee9345e189aff4a5a71a3d8ba946c7776feb8
|
||||
F src/update.c 6a0484134635f167594d597a33d186051125d3ef41803a90b246cea6cf7f11f9
|
||||
F src/vdbe.c b9ff68008f3d9d1f38525414bdcf8f62a73f458079245c17a63b2b4763d645fd
|
||||
F src/vdbeapi.c c1a9004ac554d8d48794d2ce5f80397f8e419fd28643a543cc1e004c7713c3ef
|
||||
F test/busy2.test 5a449cd1bd7616c6ce709484d3e2a419a151b75e87ec5d2c7cb26e05a15dbd7b
|
||||
F test/busy2.test 415364312743992641f9bf679c84918327296067f85a5d00012b339dc35acbd7
|
||||
F test/decimal.test 12739a01bdba4c4d79f95b323e6b67b9fad1ab6ffb56116bd2b9c81a5b19e1d9
|
||||
F test/fts3corrupt4.test 35e88f7708868a67598f1f6d3666774f6c7b34c91e3b74bd2965030fc70fb928
|
||||
F test/fuzzdata8.db 0ae860b36b79fd41cafddc9e6602358b2d5c331cf200283221e659f86e196c0c
|
||||
@ -33,7 +33,7 @@ F tool/mksqlite3c.tcl f4ef476510eca4124c874a72029f1e01bc54a896b1724e8f9eef0d8bfa
|
||||
F tool/mksqlite3h.tcl 1f5e4a1dbbbc43c83cc6e74fe32c6c620502240b66c7c0f33a51378e78fc4edf
|
||||
F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564
|
||||
F tool/speed-check.sh 615cbdf50f1409ef3bbf9f682e396df80f49d97ed93ed3e61c8e91fae6afde58
|
||||
P fa9d93cf32fac4b86044acf5d1b9ea2f36e964ed7142cf1d270986c9ef3fb766
|
||||
R a10b2894fa1e1593313267b4646751fb
|
||||
P 4d0cfb1236884349168f8e2ec5e18c0232965148af78615e0d5c9b0e13a35422
|
||||
R 1a2b9cd08dc9e49bf73c8725e57b84f3
|
||||
U dan
|
||||
Z 4819251182f23b37b4c3bd6355043693
|
||||
Z e10d9d47313abf369e15b6b18c29458c
|
||||
|
@ -1 +1 @@
|
||||
4d0cfb1236884349168f8e2ec5e18c0232965148af78615e0d5c9b0e13a35422
|
||||
f068fb116286b1dbdee9c168900348cfcab84e6d8413f3456e4e492f650d11b0
|
@ -50,5 +50,83 @@ do_multiclient_test tn {
|
||||
} {}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
do_multiclient_test tn {
|
||||
# Make the db a WAL mode db. And add a table and a row to it. Then open
|
||||
# a second connection within process 1. Process 1 now has connections
|
||||
# [db] and [db1.2], process 2 has connection [db2] only.
|
||||
#
|
||||
# Configure all connections to use a 1000 ms timeout.
|
||||
#
|
||||
do_test 2.$tn.0 {
|
||||
sql1 {
|
||||
PRAGMA journal_mode = wal;
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
code2 {
|
||||
db2 timeout 1000
|
||||
}
|
||||
code1 {
|
||||
sqlite3 db1.2 test.db
|
||||
db1.2 timeout 1000
|
||||
db timeout 1000
|
||||
db1.2 eval {SELECT * FROM t1}
|
||||
}
|
||||
} {1 2}
|
||||
|
||||
# Take a read lock with [db] in process 1.
|
||||
#
|
||||
do_test 2.$tn.1 {
|
||||
sql1 {
|
||||
BEGIN;
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {1 2}
|
||||
|
||||
# Insert a row using [db2] in process 2. Then try a passive checkpoint.
|
||||
# It fails to checkpoint the final frame (due to the readlock taken by
|
||||
# [db]), and returns in less than 250ms.
|
||||
do_test 2.$tn.2 {
|
||||
sql2 { INSERT INTO t1 VALUES(3, 4) }
|
||||
set us [lindex [time {
|
||||
set res [code2 { db2 eval { PRAGMA wal_checkpoint } }]
|
||||
}] 0]
|
||||
list [expr $us < 250000] $res
|
||||
} {1 {0 4 3}}
|
||||
|
||||
# Now try a FULL checkpoint with [db2]. It returns SQLITE_BUSY. And takes
|
||||
# over 950ms to do so.
|
||||
do_test 2.$tn.3 {
|
||||
set us [lindex [time {
|
||||
set res [code2 { db2 eval { PRAGMA wal_checkpoint = FULL } }]
|
||||
}] 0]
|
||||
list [expr $us > 950000] $res
|
||||
} {1 {1 4 3}}
|
||||
|
||||
# Passive checkpoint with [db1.2] (process 1). No SQLITE_BUSY, returns
|
||||
# in under 250ms.
|
||||
do_test 2.$tn.4 {
|
||||
set us [lindex [time {
|
||||
set res [code1 { db1.2 eval { PRAGMA wal_checkpoint } }]
|
||||
}] 0]
|
||||
list [expr $us < 250000] $res
|
||||
} {1 {0 4 3}}
|
||||
|
||||
# Full checkpoint with [db1.2] (process 1). SQLITE_BUSY returned in
|
||||
# a bit over 950ms.
|
||||
do_test 2.$tn.5 {
|
||||
set us [lindex [time {
|
||||
set res [code1 { db1.2 eval { PRAGMA wal_checkpoint = FULL } }]
|
||||
}] 0]
|
||||
list [expr $us > 950000] $res
|
||||
} {1 {1 4 3}}
|
||||
|
||||
code1 {
|
||||
db1.2 close
|
||||
}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user