Debian Codegraph @

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

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3
4 #
5 # Test the effect of Cluster Configuration Change on a concurrently-running SR transaction
6 # We use SET GLOBAL wsrep_cluster_address = '' to cause the master (node_2) to temporarily
7 # leave the cluster.
8 #
9
10 CALL mtr.add_suppression("WSREP: discarding established");
11
12 # Save original auto_increment_offset values.
13 --let $node_1=node_1
14 --let $node_2=node_2
15 --source ../galera/include/auto_increment_offset_save.inc
16
17 --connection node_2
18 CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
19
20 --let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
21 SET SESSION wsrep_trx_fragment_size = 1;
22
23 SET AUTOCOMMIT=OFF;
24 START TRANSACTION;
25 INSERT INTO t1 VALUES (1);
26 INSERT INTO t1 VALUES (2);
27 INSERT INTO t1 VALUES (3);
28 INSERT INTO t1 VALUES (4);
29 INSERT INTO t1 VALUES (5);
30
31 SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
32
33 --connection node_1
34 --let $wait_condition = SELECT COUNT(*) = 5 FROM mysql.wsrep_streaming_log
35 --source include/wait_condition.inc
36
37 SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
38
39 #
40 # Trigger CC . The transaction is aborted and we expect the SR tables to be cleaned up
41 #
42
43 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
44 --connection node_2a
45 SET SESSION wsrep_sync_wait=0;
46 --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
47 SET GLOBAL wsrep_cluster_address = '';
48
49 --let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
50 --source include/wait_condition.inc
51 SET SESSION wsrep_sync_wait = DEFAULT;
52
53 --connection node_2
54 --error 2013,2026
55 INSERT INTO t1 VALUES (6);
56
57 --connection node_1
58 --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
59 --source include/wait_condition.inc
60 SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
61
62 # Restore cluster
63
64 --connection node_2a
65 --disable_query_log
66 --eval SET GLOBAL wsrep_cluster_address='$wsrep_cluster_address_orig'
67 --enable_query_log
68
69 --connection node_1
70 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
71 --source include/wait_condition.inc
72
73
74 --connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
75 --connection node_2b
76 --source include/galera_wait_ready.inc
77 --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
78 --source include/wait_condition.inc
79 SELECT * FROM mysql.wsrep_streaming_log;
80 SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
81
82 # Repeat transaction to confirm no locks are left from previous transaction
83
84 SET AUTOCOMMIT=OFF;
85 START TRANSACTION;
86 INSERT INTO t1 VALUES (1);
87 INSERT INTO t1 VALUES (2);
88 INSERT INTO t1 VALUES (3);
89 INSERT INTO t1 VALUES (4);
90 INSERT INTO t1 VALUES (5);
91 COMMIT;
92
93 SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
94
95 --connection node_1
96 --let $wait_condition = SELECT COUNT(*) = 5 FROM t1
97 --source include/wait_condition.inc
98 SELECT COUNT(*) AS EXPECT_5 FROM t1;
99 SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
100
101 DROP TABLE t1;
102
103 --connection node_2b
104 CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for ");
105
106 --disconnect node_2
107 --connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2
108 # Restore original auto_increment_offset values.
109 --source ../galera/include/auto_increment_offset_restore.inc
110
111 --disconnect node_2a
112 --disconnect node_2b