Debian Codegraph @

mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test

raw
1 # statement rollback for SR transaction causes slave crash for inconsistency
2
3 # We test the following:
4 # 1. Create a transaction that is blocked by an SR transaction
5 # 2. Force the SR transaction to have a statement rollback
6 #
7
8 --source include/galera_cluster.inc
9 --source include/have_innodb.inc
10 --source include/have_debug_sync.inc
11
12 --connection node_1
13 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
14 CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
15 INSERT INTO t2 VALUES (6),(7),(8),(9),(10),(1);
16
17 --connection node_2
18 SET GLOBAL wsrep_slave_threads = 2;
19 SET GLOBAL debug_dbug = 'd,sync.wsrep_apply_cb';
20
21 # Begin SR transaction
22 --connection node_1
23 SET SESSION wsrep_trx_fragment_size = 1;
24 SET AUTOCOMMIT=OFF;
25 START TRANSACTION;
26 INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
27
28 # Begin non-SR transaction that will block waiting for the SR transaction
29 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
30 --connection node_1a
31 SET AUTOCOMMIT=OFF;
32 START TRANSACTION;
33 --send INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
34
35 # Cause the SR transaction to fail with a duplicate key error
36 --connection node_1
37 --send INSERT INTO t1 SELECT * FROM t2;
38
39 # Continue and commit the non-SR transaction.
40 --connection node_1a
41 --reap
42 INSERT INTO t1 VALUES (6), (7), (8), (9), (10);
43 COMMIT;
44
45 --connection node_1
46 --error ER_LOCK_DEADLOCK,ER_DUP_ENTRY
47 --reap
48
49 --connection node_2
50 SET GLOBAL wsrep_slave_threads = DEFAULT;
51 SET GLOBAL debug_dbug = '';
52 SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
53 SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
54 SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
55 SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
56
57 SELECT COUNT(*) = 10 FROM t1;
58
59 DROP TABLE t1;
60 DROP TABLE t2;
61
62 SET DEBUG_SYNC = RESET;