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] CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ; STOP REPLICA; RESET MASTER; RESET REPLICA; START REPLICA; INSERT INTO t1 VALUES ("row1","will go away",1); SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row1 will go away 1 SELECT MAX(epoch) FROM mysql.ndb_apply_status into @the_epoch; SELECT @the_epoch; @the_epoch SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row1 will go away 1 INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); DELETE FROM t1 WHERE c3 = 1; UPDATE t1 SET c2="should go away" WHERE c3 = 2; UPDATE t1 SET c2="C" WHERE c3 = 3; DELETE FROM t1 WHERE c3 = 2; SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row3 C 3 row4 D 4 SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row3 C 3 row4 D 4 include/check_slave_is_running.inc STOP REPLICA; include/check_slave_no_error.inc START REPLICA; SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row3 C 3 row4 D 4 SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row3 C 3 row4 D 4 STOP REPLICA; DROP TABLE t1; RESET master; DROP TABLE t1; RESET REPLICA; START REPLICA; CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ; INSERT INTO t1 VALUES ("row1","remove on slave",1); DELETE FROM t1; BEGIN; UPDATE t1 SET c2="does not exist" WHERE c3=1; INSERT INTO t1 VALUES ("row2","new on slave",2); COMMIT; SELECT * FROM t1; c1 c2 c3 row2 new on slave 2 include/check_slave_is_running.inc DROP TABLE IF EXISTS t1; STOP REPLICA; RESET MASTER; RESET REPLICA; START REPLICA; Let's interleave some DDL and DML in the Binlog Some DDL create table t1(a int primary key) engine=ndb; First epoch transaction begin; insert into t1 values (1), (2), (3); commit; Sync slave and retrieve epoch SELECT MAX(epoch) FROM mysql.ndb_apply_status into @first_epoch; SELECT @first_epoch; @first_epoch Slave contents select * from t1 ORDER by a; a 1 2 3 Get the next master binlog pos from the epoch Now let's do some more DDL and DML create table t2 (a int primary key) engine=ndb; begin; insert into t2 values (1), (2), (3); commit; include/check_slave_is_running.inc Stop slave and reset position to start of the applied epoch STOP REPLICA; include/check_slave_no_error.inc call mtr.add_suppression("Table \'t2\' already exists.*"); call mtr.add_suppression("Worker 1 failed executing transaction.*"); START REPLICA; include/wait_for_slave_sql_error.inc [errno=1050] SELECT COUNT(*) as FOUND_ERROR_MESSAGE FROM performance_schema.replication_applier_status_by_worker WHERE LAST_ERROR_NUMBER=1050 AND channel_name = '' AND LAST_ERROR_MESSAGE LIKE "%Table 't2' already exists%"; FOUND_ERROR_MESSAGE 1 STOP REPLICA; RESET MASTER; RESET REPLICA; START REPLICA; DROP TABLE t1; DROP TABLE t2; include/rpl_end.inc