132
133
DROP DATABASE d2;
133
134
--source include/sync_slave_sql_with_master.inc
136
###############################################################################
137
# Bug#20411374: CAN NOT EXECUTE CHANGE MASTER AFTER ERROR OCCURED IN MTS MODE
141
# When error occurred in MTS mode, If user first change master
142
# (ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS received here), and then reset slave,
143
# user can never change master (error ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS
144
# occurred again). The debug version mysqld will crash at this case.
148
# Generate MTS gaps and execute CHANGE MASTER command so that
149
# ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS error is reported. Execute RESET
150
# SLAVE command. Reexecute the CHANGE MASTER command once again it should
151
# report an assert in the case of bug scenario and it should succeed after the
153
###############################################################################
154
--source include/rpl_connection_slave.inc
155
--source include/stop_slave.inc
156
SET @save.slave_parallel_workers=@@global.slave_parallel_workers;
157
SET @@global.slave_parallel_workers=2;
158
SET @save.relay_log_info_repository=@@global.relay_log_info_repository;
159
SET @@global.relay_log_info_repository='TABLE';
160
--source include/start_slave.inc
162
--source include/rpl_connection_master.inc
165
CREATE TABLE d1.t1 (a int unique) ENGINE=INNODB;
166
CREATE TABLE d2.t1 (a int unique) ENGINE=INNODB;
167
--source include/sync_slave_sql_with_master.inc
169
INSERT INTO d1.t1 VALUES (13); # to cause the dup key error
170
# change-master with gaps
171
--source include/rpl_connection_master.inc
172
INSERT INTO d1.t1 VALUES (6);
173
INSERT INTO d2.t1 VALUES (7);
174
INSERT INTO d1.t1 VALUES (13);
175
INSERT INTO d2.t1 VALUES (8); # this worker will race over one inserting (13)
176
INSERT INTO d2.t1 VALUES (9);
178
--source include/rpl_connection_slave1.inc
179
# make sure workers doing d2.t1 raced the one that occupied with d1.t1
182
--let $wait_condition= select count(*) = 1 from $table where a = 8
183
--source include/wait_condition.inc
185
--source include/rpl_connection_slave.inc
186
# make worker executing (13) to error out
189
--let $slave_sql_errno= 1062
190
--source include/wait_for_slave_sql_error.inc
192
--source include/stop_slave_io.inc
194
--source include/rpl_connection_master.inc
196
--let $file= query_get_value(SHOW MASTER STATUS, File, 1)
197
--let $pos= query_get_value(SHOW MASTER STATUS, Position, 1)
199
--source include/rpl_connection_slave.inc
200
--replace_result $MASTER_MYPORT MASTER_PORT $file FILE $pos POS
201
--replace_column 2 ####
202
--error ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS
203
eval CHANGE MASTER TO MASTER_HOST= '127.0.0.1', MASTER_PORT= $MASTER_MYPORT, MASTER_USER= 'root',MASTER_LOG_FILE = '$file', MASTER_LOG_POS = $pos ;
205
--replace_result $MASTER_MYPORT MASTER_PORT $file FILE $pos POS
206
--replace_column 2 ####
207
eval CHANGE MASTER TO MASTER_HOST= '127.0.0.1', MASTER_PORT= $MASTER_MYPORT, MASTER_USER= 'root',MASTER_LOG_FILE = '$file', MASTER_LOG_POS = $pos ;
209
SET @@global.slave_parallel_workers= @save.slave_parallel_workers;
210
SET @@global.relay_log_info_repository= @save.relay_log_info_repository;
211
--source include/start_slave.inc
215
--source include/rpl_connection_master.inc
135
219
--source include/rpl_end.inc