Debian Codegraph @

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

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3
4 #
5 # A conflict between a streaming replication fragment and a local transaction
6 #
7
8 --connection node_1
9 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
10 SET SESSION wsrep_trx_fragment_size = 1;
11 SET AUTOCOMMIT=OFF;
12 START TRANSACTION;
13 INSERT INTO t1 VALUES (1);
14 INSERT INTO t1 VALUES (2);
15 INSERT INTO t1 VALUES (3);
16 INSERT INTO t1 VALUES (4);
17 INSERT INTO t1 VALUES (5);
18
19 --connection node_2
20 # Wait until a streaming replication fragment has arrived
21 SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
22 --let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
23 --source include/wait_condition.inc
24
25 # Attempt a conflicting INSERT. This will block
26 --send INSERT INTO t1 VALUES(1);
27
28 # Observe the block from a separate connection
29 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
30
31 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'wsrep applier committed%';
32 --source include/wait_condition.inc
33
34 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'update';
35 --source include/wait_condition.inc
36
37 # Commit the remote transaction, causing the local transaction to return an error
38 --connection node_1
39 COMMIT;
40
41 --connection node_2
42 --error ER_DUP_ENTRY
43 --reap
44
45 DROP TABLE t1;