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 connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); [on slave] include/sync_slave_sql_with_master.inc include/stop_slave.inc ==== Create some events on master ==== [on master] create table t1(n int not null auto_increment primary key); insert into t1 values (1),(2),(3),(4); drop table t1; create table t2(n int not null auto_increment primary key); insert into t2 values (1),(2); insert into t2 values (3),(4); drop table t2; ==== Replicate one event at a time on slave ==== [on slave] start slave until SOURCE_LOG_FILE='MASTER_LOG_FILE', SOURCE_LOG_POS=MASTER_LOG_POS; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead include/wait_for_slave_io_to_start.inc include/wait_for_slave_sql_to_stop.inc select * from t1; n 1 2 3 4 include/check_slave_param.inc [Exec_Master_Log_Pos] start slave until SOURCE_LOG_FILE='master-no-such-bin.000001', SOURCE_LOG_POS=MASTER_LOG_POS; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead include/wait_for_slave_io_to_start.inc include/wait_for_slave_sql_to_stop.inc select * from t1; n 1 2 3 4 include/check_slave_param.inc [Exec_Master_Log_Pos] start slave until relay_log_file='slave-relay-bin.000003', relay_log_pos=RELAY_LOG_POS; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead include/wait_for_slave_io_to_start.inc include/wait_for_slave_sql_to_stop.inc select * from t2; n 1 2 include/check_slave_param.inc [Exec_Master_Log_Pos] start slave; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead [on master] [on slave] include/sync_slave_sql_with_master.inc include/stop_slave.inc start slave until SOURCE_LOG_FILE='MASTER_LOG_FILE', SOURCE_LOG_POS=MASTER_LOG_POS; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead include/wait_for_slave_io_to_start.inc include/wait_for_slave_sql_to_stop.inc include/check_slave_param.inc [Exec_Master_Log_Pos] ==== Test various error conditions ==== start slave until SOURCE_LOG_FILE='master-bin', SOURCE_LOG_POS=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START REPLICA UNTIL start slave until SOURCE_LOG_FILE='master-bin.000001', SOURCE_LOG_POS=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START REPLICA UNTIL start slave until SOURCE_LOG_FILE='master-bin.000001'; ERROR HY000: Incorrect parameter or combination of parameters for START REPLICA UNTIL start slave until relay_log_file='slave-relay-bin.000002'; ERROR HY000: Incorrect parameter or combination of parameters for START REPLICA UNTIL start slave until relay_log_file='slave-relay-bin.000002', SOURCE_LOG_POS=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START REPLICA UNTIL start slave sql_thread; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead start slave until SOURCE_LOG_FILE='master-bin.000001', SOURCE_LOG_POS=MASTER_LOG_POS; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead Note 3083 Replication thread(s) for channel '' are already runnning. include/stop_slave.inc drop table if exists t1; reset slave; Warnings: Warning 1287 'RESET SLAVE' is deprecated and will be removed in a future release. Please use RESET REPLICA instead RESET MASTER; CHANGE REPLICATION SOURCE to SOURCE_HOST='127.0.0.1',SOURCE_PORT=MASTER_PORT, SOURCE_USER='root'; Warnings: Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. Note 1760 Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. drop table if exists t1; reset master; create table t1 (a int primary key auto_increment); start slave; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead include/stop_slave.inc master and slave are in sync now select 0 as zero; zero 0 insert into t1 set a=null; insert into t1 set a=null; select count(*) as two from t1; two 2 start slave until SOURCE_LOG_FILE='MASTER_LOG_FILE', SOURCE_LOG_POS= UNTIL_POS;; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead include/wait_for_slave_sql_to_stop.inc slave stopped at the prescribed position select 0 as zero; zero 0 select count(*) as one from t1; one 1 drop table t1; start slave; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead [connection master] # Make sure the master will put the new events in a new binlog file FLUSH LOGS; # Testing the execution until the last transaction of the master binlog include/sync_slave_sql_with_master.inc include/stop_slave_sql.inc [connection master] CREATE TABLE t1 (a INT) ENGINE=InnoDB; include/sync_slave_io_with_master.inc # Start SQL thread until it executed the CREATE TABLE START SLAVE SQL_THREAD UNTIL SOURCE_LOG_FILE = "MASTER_FILE", SOURCE_LOG_POS = MASTER_POS; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead # Wait until SQL thread reaches last master binlog file include/wait_for_slave_param.inc [Relay_Master_Log_File] # Wait until SQL thread reaches desired master binlog position include/wait_for_slave_param.inc [Exec_Master_Log_Pos] # If the desired position was reached, SQL thread should stop. include/wait_for_slave_sql_to_stop.inc include/assert.inc [t1 should be replicated] # Testing the execution until the last transaction of the slave relaylog [connection master] CREATE TABLE t2 (a INT) ENGINE=InnoDB; include/sync_slave_io_with_master.inc # Start SQL thread until it executed the CREATE TABLE START SLAVE SQL_THREAD UNTIL RELAY_LOG_FILE = "SLAVE_FILE", RELAY_LOG_POS = SLAVE_POS; Warnings: Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead # Wait until SQL thread reaches last slave relaylog file include/wait_for_slave_param.inc [Relay_Log_File] # Wait until SQL thread reaches desired slave relaylog position include/wait_for_slave_param.inc [Relay_Log_Pos] # If the desired position was reached, SQL thread should stop. include/wait_for_slave_sql_to_stop.inc include/assert.inc [t2 should be replicated] include/start_slave_sql.inc [connection master] DROP TABLE t1, t2; include/rpl_end.inc