Debian Codegraph @

mysql-test/suite/innodb/t/high_prio_trx_3.test

raw
1 # Scenario:
2 # T1= ({R(Z), R(B), W(Z), W(B)})
3 # T2= ({R(C), R(B), W(B)})
4 # T3= ({R(B), W(B), C}, HIGH_PRIORITY)
5 #
6 # Outcome: T1 must abort, T3 must commit, T2 must commit
7 # after T3.
8 #
9 # Lock -> {T1 granted, T2 waiting, T3 waiting};
10 # Then T3 jumps the queue:
11 # Lock -> {T1 granted, T3 waiting, T2 waiting};
12 # T3 Rolls back T1
13 # Lock -> {T3 granted, T2 waiting}
14
15 --source include/count_sessions.inc
16
17 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INT NOT NULL, c3 INT NOT NULL) ENGINE=InnoDB;
18 INSERT INTO t1 VALUES (0, 0, 0);
19
20 --connect(con1,localhost,root,,test)
21 --connect(con2,localhost,root,,test)
22 --connect(con3,localhost,root,,test)
23
24 --echo
25 --echo # On connection 1
26 --connection con1
27 START TRANSACTION;
28 UPDATE t1 SET c1=1, c2=1 WHERE c1=0 AND c2=0;
29
30 --echo
31 --echo # On connection 2
32 --connection con2
33 START TRANSACTION;
34 --send UPDATE t1 SET c2=2 WHERE c1=0 AND c2=3
35
36 --echo
37 --echo # On connection 3
38 --connection con3
39 --source include/start_transaction_high_prio.inc
40 UPDATE t1 SET c2=3 WHERE c2=0;
41 COMMIT;
42 --disconnect con3
43
44 --echo
45 --echo # On connection 1
46 --connection con1
47 --error ER_ERROR_DURING_COMMIT
48 COMMIT;
49 --disconnect con1
50
51 --echo
52 --echo # On connection 2
53 --connection con2
54 --reap
55 COMMIT;
56 --disconnect con2
57
58 --connection default
59 --let $assert_text= 'There is no 3 in t1'
60 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 0 AND t1.c2 = 3 AND t1.c3 = 0, count, 1] = 0
61 --source include/assert.inc
62
63 --let $assert_text= 'There is a 2 in t1'
64 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 0 AND t1.c2 = 2 AND t1.c3 = 0, count, 1] = 1
65 --source include/assert.inc
66
67 --let $assert_text= 'There is no 1 in t1'
68 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1 AND t1.c2 = 1 AND t1.c3 = 0, count, 1] = 0
69 --source include/assert.inc
70
71 DROP TABLE t1;
72
73 --source include/wait_until_count_sessions.inc