MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndb_rpl_multi_binlog_update.inc
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-slave-updates = off
38 # Identification: connection (srv_slave1), config (mysqld.2.slave).
39 # - MySQLD3
40 # Can act as slave, binlogging, log-slave-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_slave_updates';
146 --source include/show_binlog_events2.inc
147 let $BINLOG_FILENAME=master-bin;
148 --source suite/ndb_rpl/t/ndb_rpl_get_binlog_events.inc
149 
150 
151 connection srv_master1;
152 --echo
153 --echo
154 --echo
155 --echo connection srv_master1;
156 show variables like 'server_id';
157 show variables like 'log_bin';
158 show variables like 'log_slave_updates';
159 --source include/show_binlog_events2.inc
160 
161 connection srv_master2;
162 --echo
163 --echo
164 --echo
165 --echo connection srv_master2;
166 show variables like 'server_id';
167 show variables like 'log_bin';
168 show variables like 'log_slave_updates';
169 --source include/show_binlog_events2.inc
170 let $BINLOG_FILENAME=master-bin;
171 --source suite/ndb_rpl/t/ndb_rpl_get_binlog_events.inc
172 
173 connection srv_slave;
174 --echo
175 --echo
176 --echo
177 --echo connection srv_slave;
178 show variables like 'server_id';
179 show variables like 'log_bin';
180 show variables like 'log_slave_updates';
181 --source include/show_binlog_events2.inc
182 
183 connection srv_slave1;
184 --echo
185 --echo
186 --echo
187 --echo connection srv_slave1;
188 show variables like 'server_id';
189 show variables like 'log_bin';
190 show variables like 'log_slave_updates';
191 --source include/show_binlog_events2.inc
192 let $BINLOG_FILENAME=slave-master-bin;
193 --source suite/ndb_rpl/t/ndb_rpl_get_binlog_events.inc
194 
195 connection srv_slave2;
196 --echo
197 --echo
198 --echo
199 --echo connection srv_slave2;
200 show variables like 'server_id';
201 show variables like 'log_bin';
202 show variables like 'log_slave_updates';
203 --source include/show_binlog_events2.inc
204 let $BINLOG_FILENAME=slave-master-bin;
205 --source suite/ndb_rpl/t/ndb_rpl_get_binlog_events.inc
206 
207 connection $which_slave;