include/master-slave.inc
[connection master]
CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
INSERT INTO t1 VALUES ("row1","will go away",1);
SELECT * FROM t1 ORDER BY c3;
c1	c2	c3
row1	will go away	1
SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
@the_epoch:=MAX(epoch)
<the_epoch>
SELECT * FROM t1 ORDER BY c3;
c1	c2	c3
row1	will go away	1
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position	@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
<the_pos>	master-bin.000001
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 SLAVE;
CHANGE MASTER TO
master_log_file = 'master-bin.000001',
master_log_pos = <the_pos> ;
include/check_slave_no_error.inc
START SLAVE;
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 SLAVE;
DROP TABLE t1;
RESET master;
DROP TABLE t1;
RESET slave;
START SLAVE;
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;
include/rpl_end.inc
