Debian Codegraph @

mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3
4 #
5 # Test the following sequence of events on the master:
6 #
7 # 1. Connection #1 begins a SR transaction
8 # 2. Connection #2 issues DDL
9 # 3. Connection #1 attempts to continue the transaction, gets deadlock
10 # 4. Connection #1 retries the transaction and succeeds
11 #
12
13 --connection node_1
14 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
15
16 SET SESSION wsrep_trx_fragment_size = 1;
17
18 SET AUTOCOMMIT=OFF;
19 START TRANSACTION;
20
21 INSERT INTO t1 VALUES (1);
22 INSERT INTO t1 VALUES (2);
23 INSERT INTO t1 VALUES (3);
24 INSERT INTO t1 VALUES (4);
25 INSERT INTO t1 VALUES (5);
26
27 --connection node_2
28 # SR replication is triggered and rows have been delivered to the slave
29 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
30 --let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
31 --source include/wait_condition.inc
32 SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
33
34 SELECT COUNT(*) as expect_5 FROM mysql.wsrep_streaming_log;
35
36 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
37 ALTER TABLE t1 ADD COLUMN f2 INTEGER;
38
39 --connection node_1
40 --error ER_LOCK_DEADLOCK
41 INSERT INTO t1 VALUES (6);
42
43 SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
44
45 # Check that the transaction thus aborted could be reissued
46
47 ROLLBACK;
48 START TRANSACTION;
49 INSERT INTO t1 (f1) VALUES (1);
50 INSERT INTO t1 (f1) VALUES (2);
51 INSERT INTO t1 (f1) VALUES (3);
52 INSERT INTO t1 (f1) VALUES (4);
53 INSERT INTO t1 (f1) VALUES (5);
54 INSERT INTO t1 (f1) VALUES (6);
55 COMMIT;
56
57 SELECT COUNT(*) as expect_6 FROM t1;
58 SELECT * FROM t1;
59 SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
60
61 --connection node_2
62 SELECT COUNT(*) as expect_6 FROM t1;
63 SELECT * FROM t1;
64 SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
65
66 DROP TABLE t1;