Debian Codegraph @

mysql-test/suite/ndb_rpl/t/ndb_rpl_multi_binlog_update.inc

raw
1 ###############################################################################
2 # Description: Performs binloggable and non binloggable DDL and DML at each
3 # MySQLD in pair of clusters with (at least) 3 MySQLDs each.
4 # Then connects to each MySQLD and examines the contents of
5 # its Binlog.
6 # Expected contents depends on the configuration of Binlogging
7 # in the cluster used.
8 # Default from rpl_ndb_multi_binlog_update.test is as shown
9 # below.
10 #
11 # Testing scenario: Cluster 1 replicates to Cluster 2
12 #
13 # Key : BL= Binlogging, LSU = LogSlaveUpdates = On
14 #
15 # BL BL
16 # cluster 1 [ srv_master srv_master1 srv_master2 ]
17 # |
18 # |-----------------------
19 # v v v
20 # cluster 2 [ srv_slave srv_slave1 srv_slave2 ]
21 # BL BL LSU
22 #
23 # Cluster 1:
24 # - Schema change originates on all severs in Cluster 1
25 # - MySQLD1 which is binlogging master.
26 # Identification: connection (srv_master), config (mysqld.1.1).
27 # - MySQLD2 which is not binlogging.
28 # Identification: connection (srv_master1), config (mysqld.1.2).
29 # - MySQLD3 which is binlogging but not currently master.
30 # Identification: connection (srv_master2), config (mysqld.1.3).
31 #
32 # Cluster 2:
33 # - MySQLD1:
34 # Can act as slave, not binlogging
35 # Identification: connection (srv_slave), config (mysqld.1.slave).
36 # - MySQLD2:
37 # Can act as slave, binlogging, log-replica-updates = off
38 # Identification: connection (srv_slave1), config (mysqld.2.slave).
39 # - MySQLD3
40 # Can act as slave, binlogging, log-replica-updates = on
41 # Identification: connection (srv_slave2), config (mysqld.3.slave).
42 #
43 # See rpl_ndb_multi_binlog_update.test for default configuration.
44 # Originally motivated by bug#45756
45 # See rpl_ndb_slave_lsu.test for full testcase
46 #
47 # Preconditions :
48 # - Connections srv_master, srv_master1, srv_master2, srv_slave,
49 # srv_slave1, srv_slave2 exist.
50 # - $which_slave contains the name of the slave server performing
51 # the replication slave role.
52 #
53 ###############################################################################
54
55 ###############################################################################
56 # Checking Replication
57 ###############################################################################
58 --echo *** Generating slave cluster originated binloggable changes ***
59 connection srv_slave;
60 CREATE TABLE bug_45756_slave_logged_1 (a int) engine = NDB;
61 INSERT INTO bug_45756_slave_logged_1 VALUES (1);
62 DROP TABLE bug_45756_slave_logged_1;
63
64 connection srv_slave1;
65 CREATE TABLE bug_45756_slave_logged_2 (a int) engine = NDB;
66 INSERT INTO bug_45756_slave_logged_2 VALUES (1);
67 DROP TABLE bug_45756_slave_logged_2;
68
69 connection srv_slave2;
70 CREATE TABLE bug_45756_slave_logged_3 (a int) engine = NDB;
71 INSERT INTO bug_45756_slave_logged_3 VALUES (1);
72 DROP TABLE bug_45756_slave_logged_3;
73
74 --echo ***Generating slave cluster non-binloggable changes***
75 connection srv_slave;
76 SET SQL_LOG_BIN= 0;
77 CREATE TABLE bug_45756_slave_not_logged_1 (a int) engine = NDB;
78 INSERT INTO bug_45756_slave_not_logged_1 VALUES (1);
79 DROP TABLE bug_45756_slave_not_logged_1;
80 SET SQL_LOG_BIN= 1;
81
82 connection srv_slave1;
83 SET SQL_LOG_BIN= 0;
84 CREATE TABLE bug_45756_slave_not_logged_2 (a int) engine = NDB;
85 INSERT INTO bug_45756_slave_not_logged_2 VALUES (1);
86 DROP TABLE bug_45756_slave_not_logged_2;
87 SET SQL_LOG_BIN= 1;
88
89 connection srv_slave2;
90 SET SQL_LOG_BIN= 0;
91 CREATE TABLE bug_45756_slave_not_logged_3 (a int) engine = NDB;
92 INSERT INTO bug_45756_slave_not_logged_3 VALUES (1);
93 DROP TABLE bug_45756_slave_not_logged_3;
94 SET SQL_LOG_BIN= 1;
95
96 --echo *** Generating data to be replicated ***
97 connection srv_master;
98 CREATE TABLE bug45756_master_logged_1 (a int) engine = NDB;
99 INSERT INTO bug45756_master_logged_1 VALUES (1);
100 DROP TABLE bug45756_master_logged_1;
101
102 connection srv_master1;
103 CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB;
104 INSERT INTO bug45756_master_logged_2 VALUES (1);
105 DROP TABLE bug45756_master_logged_2;
106
107 connection srv_master2;
108 CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB;
109 INSERT INTO bug45756_master_logged_3 VALUES (1);
110 DROP TABLE bug45756_master_logged_3;
111
112 --echo *** Generating changes not to be replicated ***
113 connection srv_master;
114 SET SQL_LOG_BIN= 0;
115 CREATE TABLE bug45756_master_not_logged_1 (a int) engine = NDB;
116 INSERT INTO bug45756_master_not_logged_1 VALUES (1);
117 DROP TABLE bug45756_master_not_logged_1;
118 SET SQL_LOG_BIN= 1;
119
120 connection srv_master1;
121 SET SQL_LOG_BIN= 0;
122 CREATE TABLE bug45756_master_not_logged_2 (a int) engine = NDB;
123 INSERT INTO bug45756_master_not_logged_2 VALUES (1);
124 DROP TABLE bug45756_master_not_logged_2;
125 SET SQL_LOG_BIN= 1;
126
127 connection srv_master2;
128 SET SQL_LOG_BIN= 0;
129 CREATE TABLE bug45756_master_not_logged_3 (a int) engine = NDB;
130 INSERT INTO bug45756_master_not_logged_3 VALUES (1);
131 DROP TABLE bug45756_master_not_logged_3;
132 SET SQL_LOG_BIN= 1;
133
134 connection srv_master;
135 sync_slave_with_master $which_slave;
136
137 --echo *** Checking binlog contents on every server in both clusters ***
138 connection srv_master;
139 --echo
140 --echo
141 --echo
142 --echo connection srv_master;
143 show variables like 'server_id';
144 show variables like 'log_bin';
145 show variables like 'log_replica_updates';
146 let $show_binlog_events_mask_columns=2,5; # Show server_id
147 --source include/show_binlog_events.inc
148 let $BINLOG_FILENAME=master-bin;
149 --source suite/ndb_rpl/t/ndb_rpl_get_binlog_events.inc
150
151
152 connection srv_master1;
153 --echo
154 --echo
155 --echo
156 --echo connection srv_master1;
157 show variables like 'server_id';
158 show variables like 'log_bin';
159 show variables like 'log_replica_updates';
160 # Binlogging disabled, show it's empty
161 show binlog events;
162
163 connection srv_master2;
164 --echo
165 --echo
166 --echo
167 --echo connection srv_master2;
168 show variables like 'server_id';
169 show variables like 'log_bin';
170 show variables like 'log_replica_updates';
171 let $show_binlog_events_mask_columns=2,5; # Show server_id
172 --source include/show_binlog_events.inc
173 let $BINLOG_FILENAME=master-bin;
174 --source suite/ndb_rpl/t/ndb_rpl_get_binlog_events.inc
175
176 connection srv_slave;
177 --echo
178 --echo
179 --echo
180 --echo connection srv_slave;
181 show variables like 'server_id';
182 show variables like 'log_bin';
183 show variables like 'log_replica_updates';
184 # Binlogging disabled, show it's empty
185 show binlog events;
186
187 connection srv_slave1;
188 --echo
189 --echo
190 --echo
191 --echo connection srv_slave1;
192 show variables like 'server_id';
193 show variables like 'log_bin';
194 show variables like 'log_replica_updates';
195 let $show_binlog_events_mask_columns=2,5; # Show server_id
196 --source include/show_binlog_events.inc
197 let $BINLOG_FILENAME=slave-master-bin;
198 --source suite/ndb_rpl/t/ndb_rpl_get_binlog_events.inc
199
200 connection srv_slave2;
201 --echo
202 --echo
203 --echo
204 --echo connection srv_slave2;
205 show variables like 'server_id';
206 show variables like 'log_bin';
207 show variables like 'log_replica_updates';
208 let $show_binlog_events_mask_columns=2,5; # Show server_id
209 --source include/show_binlog_events.inc
210 let $BINLOG_FILENAME=slave-master-bin;
211 --source suite/ndb_rpl/t/ndb_rpl_get_binlog_events.inc
212
213 connection $which_slave;