mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Add tests for some lock-contention cases.
FossilOrigin-Name: f0fcb9c9a67e2bf7bbedbedbc27791b605a21dd1
This commit is contained in:
28
manifest
28
manifest
@@ -1,8 +1,5 @@
|
|||||||
-----BEGIN PGP SIGNED MESSAGE-----
|
C Add\stests\sfor\ssome\slock-contention\scases.
|
||||||
Hash: SHA1
|
D 2010-05-06T12:15:48
|
||||||
|
|
||||||
C Remove\sthe\snoop-mutex\simplementations\sof\smutex_held()\sand\smutex_notheld()\s\nsince\sthey\sare\sboth\sunreachable.
|
|
||||||
D 2010-05-06T11:56:52
|
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
|
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -210,7 +207,7 @@ F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
|
|||||||
F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6
|
F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6
|
||||||
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
|
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
|
||||||
F src/test_thread.c aa9919c885a1fe53eafc73492f0898ee6c0a0726
|
F src/test_thread.c aa9919c885a1fe53eafc73492f0898ee6c0a0726
|
||||||
F src/test_vfs.c 43ae46c9636a4d568d98b1e175e68487fb53a6c7
|
F src/test_vfs.c e38d3619a85b11b14a16fdb7354bdaf25f9d39fc
|
||||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||||
F src/tokenize.c 25ceb0f0a746ea1d0f9553787f3f0a56853cfaeb
|
F src/tokenize.c 25ceb0f0a746ea1d0f9553787f3f0a56853cfaeb
|
||||||
F src/trigger.c 8927588cb9e6d47f933b53bfe74200fbb504100d
|
F src/trigger.c 8927588cb9e6d47f933b53bfe74200fbb504100d
|
||||||
@@ -227,7 +224,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
|
|||||||
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
|
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
|
||||||
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
|
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
|
||||||
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
||||||
F src/wal.c 2db3bd804def9c18008c99408a81cd6eafc12a99
|
F src/wal.c 5fa16130ca31747510f95cfdecfde0e2834f4923
|
||||||
F src/wal.h b4c42014b5fa3b4e6244ac8c65de7ff67adeb27c
|
F src/wal.h b4c42014b5fa3b4e6244ac8c65de7ff67adeb27c
|
||||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||||
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
|
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
|
||||||
@@ -765,7 +762,7 @@ F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
|
|||||||
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
||||||
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
|
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
|
||||||
F test/wal.test f0b331017a12a31dd4bbb20aee9c179fbfdd5921
|
F test/wal.test f0b331017a12a31dd4bbb20aee9c179fbfdd5921
|
||||||
F test/wal2.test cf110b3231c7282439bef62daebcf81a993b62c9
|
F test/wal2.test d56139ed12d2680edd867bc55fb843109e5ead26
|
||||||
F test/walbak.test a0e45187c7d8928df035dfea29b99b016b21ca3c
|
F test/walbak.test a0e45187c7d8928df035dfea29b99b016b21ca3c
|
||||||
F test/walcrash.test f6d5fb2bb108876f04848720a488065d9deef69f
|
F test/walcrash.test f6d5fb2bb108876f04848720a488065d9deef69f
|
||||||
F test/walfault.test 2d6e00e07ae4287d6ae552589bcc8532697d8173
|
F test/walfault.test 2d6e00e07ae4287d6ae552589bcc8532697d8173
|
||||||
@@ -816,14 +813,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P ed817fc893e7162ae0ff4022591f7e9e3b81d622
|
P 6767b62a9a063582889f5ceb42f95eab24c697da
|
||||||
R 1cc871189382ddc6b298212ee12ba002
|
R 36d041a467bd775916bd009df85b9ff3
|
||||||
U drh
|
U dan
|
||||||
Z 71ef84aad0c664aa0a94b1c0e7e9223b
|
Z 5e2467a63542c24c70ddf9b2bcc52a27
|
||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
|
||||||
|
|
||||||
iD8DBQFL4q6HoxKgR168RlERArtFAJ0YA4njgElyNIjA19j3/e9AUIIBiACaA2tm
|
|
||||||
neKsTkrsmECROCVgTmK9o0I=
|
|
||||||
=wyXD
|
|
||||||
-----END PGP SIGNATURE-----
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
6767b62a9a063582889f5ceb42f95eab24c697da
|
f0fcb9c9a67e2bf7bbedbedbc27791b605a21dd1
|
@@ -387,6 +387,7 @@ static int tvfsResultCode(Testvfs *p, int *pRc){
|
|||||||
{ SQLITE_ERROR, "SQLITE_ERROR" },
|
{ SQLITE_ERROR, "SQLITE_ERROR" },
|
||||||
{ SQLITE_IOERR, "SQLITE_IOERR" },
|
{ SQLITE_IOERR, "SQLITE_IOERR" },
|
||||||
{ SQLITE_LOCKED, "SQLITE_LOCKED" },
|
{ SQLITE_LOCKED, "SQLITE_LOCKED" },
|
||||||
|
{ SQLITE_BUSY, "SQLITE_BUSY" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *z;
|
const char *z;
|
||||||
|
@@ -219,6 +219,7 @@ static void walChecksumBytes(u8 *aByte, int nByte, u32 *aCksum){
|
|||||||
static int walSetLock(Wal *pWal, int desiredStatus){
|
static int walSetLock(Wal *pWal, int desiredStatus){
|
||||||
int rc, got;
|
int rc, got;
|
||||||
if( pWal->lockState==desiredStatus ) return SQLITE_OK;
|
if( pWal->lockState==desiredStatus ) return SQLITE_OK;
|
||||||
|
got = pWal->lockState;
|
||||||
rc = pWal->pVfs->xShmLock(pWal->pVfs, pWal->pWIndex, desiredStatus, &got);
|
rc = pWal->pVfs->xShmLock(pWal->pVfs, pWal->pWIndex, desiredStatus, &got);
|
||||||
pWal->lockState = got;
|
pWal->lockState = got;
|
||||||
if( got==SQLITE_SHM_READ_FULL || got==SQLITE_SHM_READ ){
|
if( got==SQLITE_SHM_READ_FULL || got==SQLITE_SHM_READ ){
|
||||||
|
@@ -236,4 +236,75 @@ db2 close
|
|||||||
tvfs delete
|
tvfs delete
|
||||||
file delete -force test.db test.db-wal test.db-journal
|
file delete -force test.db test.db-wal test.db-journal
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# This test case - wal2-3.* - tests the response of the library to an
|
||||||
|
# SQLITE_BUSY when attempting to obtain a READ or RECOVER lock.
|
||||||
|
#
|
||||||
|
# wal2-3.0 - 2: SQLITE_BUSY when obtaining a READ lock
|
||||||
|
# wal2-3.3 - 6: SQLITE_BUSY when obtaining a RECOVER lock
|
||||||
|
#
|
||||||
|
do_test wal2-3.0 {
|
||||||
|
proc tvfs_cb {method args} {
|
||||||
|
if {$method == "xShmLock"} {
|
||||||
|
if {[info exists ::locked]} { return SQLITE_BUSY }
|
||||||
|
}
|
||||||
|
return SQLITE_OK
|
||||||
|
}
|
||||||
|
|
||||||
|
proc busyhandler x {
|
||||||
|
if {$x>3} { unset -nocomplain ::locked }
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
testvfs tvfs tvfs_cb
|
||||||
|
sqlite3 db test.db -vfs tvfs
|
||||||
|
db busy busyhandler
|
||||||
|
|
||||||
|
execsql {
|
||||||
|
PRAGMA journal_mode = WAL;
|
||||||
|
CREATE TABLE t1(a);
|
||||||
|
INSERT INTO t1 VALUES(1);
|
||||||
|
INSERT INTO t1 VALUES(2);
|
||||||
|
INSERT INTO t1 VALUES(3);
|
||||||
|
INSERT INTO t1 VALUES(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
set ::locked 1
|
||||||
|
info exists ::locked
|
||||||
|
} {1}
|
||||||
|
do_test wal2-3.1 {
|
||||||
|
execsql { SELECT count(a), sum(a) FROM t1 }
|
||||||
|
} {4 10}
|
||||||
|
do_test wal2-3.2 {
|
||||||
|
info exists ::locked
|
||||||
|
} {0}
|
||||||
|
|
||||||
|
do_test wal2-3.3 {
|
||||||
|
proc tvfs_cb {method args} {
|
||||||
|
if {$method == "xShmLock"} {
|
||||||
|
if {[info exists ::sabotage]} {
|
||||||
|
unset -nocomplain ::sabotage
|
||||||
|
incr_tvfs_hdr [lindex $args 0] 1 1
|
||||||
|
}
|
||||||
|
if {[info exists ::locked] && [lindex $args 2] == "RECOVER"} {
|
||||||
|
return SQLITE_BUSY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SQLITE_OK
|
||||||
|
}
|
||||||
|
|
||||||
|
set ::sabotage 1
|
||||||
|
set ::locked 1
|
||||||
|
list [info exists ::sabotage] [info exists ::locked]
|
||||||
|
} {1 1}
|
||||||
|
do_test wal2-3.4 {
|
||||||
|
execsql { SELECT count(a), sum(a) FROM t1 }
|
||||||
|
} {4 10}
|
||||||
|
do_test wal2-3.5 {
|
||||||
|
list [info exists ::sabotage] [info exists ::locked]
|
||||||
|
} {0 0}
|
||||||
|
db close
|
||||||
|
tvfs delete
|
||||||
|
file delete -force test.db test.db-wal test.db-journal
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
Reference in New Issue
Block a user