include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection master] [connection slave] call mtr.add_suppression("Duplicate entry*"); call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); call mtr.add_suppression("Failed to initialize the master info structure"); call mtr.add_suppression("Slave failed to initialize relay log info*"); call mtr.add_suppression("MTS recovery: automatic recovery failed.*"); call mtr.add_suppression("Recovery from master pos"); #### I. Initialize #### [connection slave] include/stop_slave.inc SET @save.innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout; set @@global.innodb_lock_wait_timeout=5 + 1000; include/start_slave.inc [connection master] CREATE DATABASE d1; CREATE DATABASE d2; CREATE TABLE d1.t (a INT PRIMARY KEY, name text) ENGINE=INNODB; CREATE TABLE d2.t (a INT PRIMARY KEY, name text) ENGINE=INNODB; #### II. Prepare test scenario #### include/sync_slave_sql_with_master.inc BEGIN; INSERT INTO d2.t VALUES (2, 'Slave local'); INSERT INTO d1.t VALUES (3, 'Slave local'); [connection master] INSERT INTO d1.t VALUES (1, 'T1'); INSERT INTO d2.t VALUES (1, 'T2'); INSERT INTO d2.t VALUES (2, 'T3'); INSERT INTO d2.t VALUES (3, 'T4'); INSERT INTO d1.t VALUES (2, 'T5'); [connection slave1] # Now d1.t has two rows and d2.t has one row. [connection slave] COMMIT; include/wait_for_slave_sql_error.inc [errno=1062] include/rpl_restart_server.inc [server_number=2 parameters: --skip_slave_start=TRUE --relay_log_info_repository=TABLE --master_info_repository=TABLE --sync_master_info=1 --relay-log-recovery=1] [connection slave] Relay log recovery should fail as MTS stopped due to an error START SLAVE; ERROR HY000: Slave failed to initialize relay log info structure from the repository Eliminate the cause of MTS error DELETE FROM d2.t WHERE a=2; DELETE FROM d1.t WHERE a=3; include/rpl_restart_server.inc [server_number=2 parameters: --skip_slave_start=TRUE --relay_log_info_repository=TABLE --master_info_repository=TABLE --sync_master_info=1 --relay-log-recovery=1] MTS recovery should be successful. Check that gaps are filled. include/assert.inc [Table d1.t should contain 2 rows.] include/assert.inc [Table d2.t should contain 3 rows.] include/start_slave.inc [connection master] include/sync_slave_sql_with_master.inc include/diff_tables.inc [master:d1.t, slave:d1.t] include/diff_tables.inc [master:d2.t, slave:d2.t] [connection master] DROP DATABASE d1; DROP DATABASE d2; include/rpl_end.inc