Debian Codegraph @

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

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