mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Add miscellaneous test cases for concurrent transactions.
FossilOrigin-Name: 779b1d0e17bc54062b2b09cdbf94e9e2f4bae4f7
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
||||
C If\s"PRAGMA\sintegrity_check"\sis\srun\swhile\sthe\sdatabase\sis\sbeing\swritten\sby\sa\sCONCURRENT\stransaction,\sdo\snot\sconsider\sunreferenced\spages\sto\sbe\san\serror.\sThey\smay\sbe\spart\sof\sthe\sfree-page\slist,\swhich\sis\snot\svisible\sat\sthe\sb-tree\slayer\swhen\srunning\sa\sCONCURRENT\stransaction.
|
||||
D 2015-08-25T17:16:33.362
|
||||
C Add\smiscellaneous\stest\scases\sfor\sconcurrent\stransactions.
|
||||
D 2015-08-25T19:10:29.114
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in e2218eb228374422969de7b1680eda6864affcef
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -524,8 +524,8 @@ F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6
|
||||
F test/colmeta.test 2c765ea61ee37bc43bbe6d6047f89004e6508eb1
|
||||
F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b
|
||||
F test/concfault.test 500f17c3fcfe7705114422bcc6ddd3c740001a43
|
||||
F test/concurrent.test 26c2d49abbf4847ceed9bf8cf7fbe9a2a4ffc70c
|
||||
F test/concurrent2.test fa570bf9723f5c30fe40d9f2b1faa55c3c712c41
|
||||
F test/concurrent.test ecf97fdcfb11dda1db52b2714d7d52d0922789f1
|
||||
F test/concurrent2.test de43cd6703360dc6268907f1617f0d353d8a43c1
|
||||
F test/concurrent3.test 7dcf81372c06cbac58e7e630aebf7292945947bb
|
||||
F test/conflict.test 841bcf7cabbfca39c577eb8411ea8601843b46a8
|
||||
F test/conflict2.test 0d3af4fb534fa1bd020c79960bb56e4d52655f09
|
||||
@@ -1382,7 +1382,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P c746e0bd20cb136eed2b691f326657d266e2f1ed
|
||||
R e20e0a06f63966f8ec3b7d9acf7660a9
|
||||
P f32b57b49311693eb0c0c9f6f14859e7b1fa93d8
|
||||
R cbe24c6dda59af48460d1125c5ffff88
|
||||
U dan
|
||||
Z 220f77062430ec96f6fa5ad5d41eac8b
|
||||
Z 967a64b7790792e3ecfbe18cee7c81a2
|
||||
|
@@ -1 +1 @@
|
||||
f32b57b49311693eb0c0c9f6f14859e7b1fa93d8
|
||||
779b1d0e17bc54062b2b09cdbf94e9e2f4bae4f7
|
@@ -417,7 +417,7 @@ do_multiclient_test tn {
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Unlocked transactions may not modify the user_version or application_id.
|
||||
# Concurrent transactions may not modify the user_version or application_id.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 3.0 {
|
||||
@@ -448,6 +448,62 @@ do_execsql_test 3.5 {
|
||||
SELECT * FROM t1;
|
||||
} {10 0 a b c d}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# However, another transaction modifying the user_version or application_id
|
||||
# should not cause a conflict. And committing a concurrent transaction does not
|
||||
# clobber the modification - even if the concurrent transaction allocates or
|
||||
# frees database pages.
|
||||
#
|
||||
do_multiclient_test tn {
|
||||
do_test 4.$tn.1 {
|
||||
sql1 {
|
||||
PRAGMA journal_mode = wal;
|
||||
CREATE TABLE ttt(y UNIQUE, z UNIQUE);
|
||||
PRAGMA user_version = 14;
|
||||
BEGIN CONCURRENT;
|
||||
INSERT INTO ttt VALUES('y', 'z');
|
||||
}
|
||||
} {wal}
|
||||
do_test 4.$tn.2 {
|
||||
sql2 { PRAGMA user_version = 16 }
|
||||
sql1 COMMIT
|
||||
sql1 { PRAGMA user_version }
|
||||
} {16}
|
||||
|
||||
do_test 4.$tn.3 {
|
||||
sql1 {
|
||||
BEGIN CONCURRENT;
|
||||
INSERT INTO ttt VALUES(randomblob(10000), randomblob(4));
|
||||
PRAGMA user_version;
|
||||
}
|
||||
} {16}
|
||||
do_test 4.$tn.4 {
|
||||
sql2 { PRAGMA user_version = 1234 }
|
||||
sql1 {
|
||||
PRAGMA user_version;
|
||||
COMMIT;
|
||||
PRAGMA user_version;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {16 1234 ok}
|
||||
|
||||
do_test 4.$tn.5 {
|
||||
sql1 {
|
||||
BEGIN CONCURRENT;
|
||||
DELETE FROM ttt;
|
||||
PRAGMA user_version;
|
||||
}
|
||||
} {1234}
|
||||
do_test 4.$tn.4 {
|
||||
sql2 { PRAGMA user_version = 5678 }
|
||||
sql1 {
|
||||
PRAGMA user_version;
|
||||
COMMIT;
|
||||
PRAGMA user_version;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {1234 5678 ok}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
@@ -369,5 +369,64 @@ do_execsql_test 8.5 {
|
||||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that concurrent transactions do not allow foreign-key constraints
|
||||
# to be bypassed.
|
||||
#
|
||||
do_multiclient_test tn {
|
||||
do_test 9.$tn.1 {
|
||||
sql1 {
|
||||
PRAGMA journal_mode = wal;
|
||||
CREATE TABLE pp(i INTEGER PRIMARY KEY, j);
|
||||
CREATE TABLE cc(a, b REFERENCES pp);
|
||||
|
||||
WITH seq(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM seq WHERE i<100)
|
||||
INSERT INTO pp SELECT i, randomblob(1000) FROM seq;
|
||||
|
||||
PRAGMA foreign_keys = 1;
|
||||
}
|
||||
} {wal}
|
||||
|
||||
|
||||
do_test 9.$tn.2.1 {
|
||||
sql1 {
|
||||
BEGIN CONCURRENT;
|
||||
INSERT INTO cc VALUES(42, 42);
|
||||
}
|
||||
} {}
|
||||
do_test 9.$tn.2.2 {
|
||||
sql2 { DELETE FROM pp WHERE i=42 }
|
||||
list [catch { sql1 COMMIT } msg] $msg
|
||||
} {1 {database is locked}}
|
||||
do_test 9.$tn.2.3 {
|
||||
sql1 ROLLBACK
|
||||
} {}
|
||||
|
||||
do_test 9.$tn.3.1 {
|
||||
sql1 {
|
||||
PRAGMA foreign_keys = 0;
|
||||
BEGIN CONCURRENT;
|
||||
INSERT INTO cc VALUES(43, 43);
|
||||
}
|
||||
} {}
|
||||
do_test 9.$tn.3.2 {
|
||||
sql2 { DELETE FROM pp WHERE i=43 }
|
||||
list [catch { sql1 COMMIT } msg] $msg
|
||||
} {0 {}}
|
||||
|
||||
do_test 9.$tn.4.1 {
|
||||
sql1 {
|
||||
PRAGMA foreign_keys = on;
|
||||
BEGIN CONCURRENT;
|
||||
INSERT INTO cc VALUES(44, 44);
|
||||
}
|
||||
} {}
|
||||
do_test 9.$tn.4.2 {
|
||||
sql2 { DELETE FROM pp WHERE i=1 }
|
||||
list [catch { sql1 COMMIT } msg] $msg
|
||||
} {0 {}}
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
Reference in New Issue
Block a user