summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db_cc.test
blob: 27698121c0d11f1226afd3a73452472674710191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#
# Test the case where a Galera slave to async replication goes non-prim while
# a stream of replication events including filtered events is arriving
#

--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/big_test.inc

# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc

--connection node_1
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;

--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
RESET MASTER;

--connection node_2
SET global wsrep_on=OFF;
RESET MASTER;
SET global wsrep_on=ON;

--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
--enable_query_log
START SLAVE USER='root';

--connection node_1
CREATE SCHEMA test1;
CREATE SCHEMA test2;
USE test1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
USE test2;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;

INSERT INTO test1.t1 (f1) VALUES (1);
INSERT INTO test2.t1 (f1) VALUES (1);

INSERT INTO test1.t1 (f1) VALUES (2);
INSERT INTO test2.t1 (f1) VALUES (2);

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

--let $wait_condition = SELECT COUNT(*) = 2 FROM test1.t1;
--source include/wait_condition.inc

SET GLOBAL wsrep_provider_options='gmcast.isolate=1';

--connection node_1
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);

--connection node_2
SET SESSION wsrep_on=OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
--source include/wait_condition.inc

--let $slave_sql_errno = 1047
--source include/wait_for_slave_sql_error.inc

--connection node_1
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);

--connection node_2
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';

--connection node_1
INSERT INTO test1.t1 (f1) VALUES (5);
INSERT INTO test2.t1 (f1) VALUES (5);

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
--source include/wait_condition.inc
SET SESSION wsrep_on=ON;
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_ready';
--source include/wait_condition.inc

--connection node_1
INSERT INTO test1.t1 (f1) VALUES (6);
INSERT INTO test2.t1 (f1) VALUES (6);

--connection node_2
START SLAVE;

#
# Consistency checks
#

--sleep 2
--connection node_2
--let $wait_condition = SELECT COUNT(DISTINCT f1) = 6 FROM test1.t1;
--source include/wait_condition.inc

--connection node_3
--let $wait_condition = SELECT COUNT(DISTINCT f1) = 6 FROM test1.t1;
--source include/wait_condition.inc

--connection node_2
--let $gtid_executed_node2 = `SELECT @@global.gtid_executed;`

--let $effective_uuid_1 = `SELECT SUBSTRING_INDEX(@@global.gtid_executed, ':', 1)`
--let $effective_uuid_2 = `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(@@global.gtid_executed, '\n', -1), ':', 1)`

--replace_result $effective_uuid_1 <effective_uuid_1> $effective_uuid_2 <effective_uuid_2>
--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;

--error 1049
USE test2;

--connection node_3

--disable_query_log
--eval SELECT '$gtid_executed_node2' = @@global.gtid_executed AS gtid_executed_equal;
--enable_query_log

--error 1049
USE test2;

--replace_result $effective_uuid_1 <effective_uuid_1> $effective_uuid_2 <effective_uuid_2>
--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;

#
# Cleanup
#

--connection node_1
DROP SCHEMA test1;
DROP SCHEMA test2;

--sleep 1

--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

--connection node_2
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression("GTID replication failed");
CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed");
CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
CALL mtr.add_suppression("TO isolation failed for");
CALL mtr.add_suppression("Slave SQL: Error 'Deadlock found when trying to get lock; try restarting transaction' on query");
CALL mtr.add_suppression("Slave SQL: Error 'WSREP has not yet prepared node for application use' on query");
CALL mtr.add_suppression("Slave: WSREP has not yet prepared node for application use Error_code: 1047");