1
--source include/have_multi_ndb.inc
2
--source include/have_binlog_format_mixed_or_row.inc
3
--source include/ndb_master-slave.inc
5
# note: server2 is another "master" connected to the master cluster
8
# Currently test only works with ndb since it retrieves "old"
9
# binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
12
# create a table with one row, and make sure the other "master" gets it
13
CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
18
INSERT INTO t1 VALUES ("row1","will go away",1);
19
SELECT * FROM t1 ORDER BY c3;
21
SELECT * FROM t1 ORDER BY c3;
23
# sync slave and retrieve epoch and stop the slave
25
sync_slave_with_master;
26
--replace_column 1 <the_epoch>
27
SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
28
let $the_epoch= `select @the_epoch` ;
29
SELECT * FROM t1 ORDER BY c3;
32
# get the master binlog pos from the epoch, from the _other_ "master", server2
34
--replace_result $the_epoch <the_epoch>
35
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
36
FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
37
let $the_pos= `SELECT @the_pos` ;
38
let $the_file= `SELECT @the_file` ;
40
# now connect the slave to the _other_ "master"
42
--replace_result $MASTER_MYPORT1 <MASTER_PORT1>
44
master_port=$MASTER_MYPORT1,
45
master_log_file = '$the_file',
46
master_log_pos = $the_pos ;
49
# insert some more values on the first master
51
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
52
DELETE FROM t1 WHERE c3 = 1;
53
UPDATE t1 SET c2="should go away" WHERE c3 = 2;
54
UPDATE t1 SET c2="C" WHERE c3 = 3;
55
DELETE FROM t1 WHERE c3 = 2;
57
SELECT * FROM t1 ORDER BY c3;
59
# insert another row, and check that we have it on the slave
61
INSERT INTO t1 VALUES ("row5","E",5);
62
SELECT * FROM t1 ORDER BY c3;
63
sync_slave_with_master;
65
SELECT * FROM t1 ORDER BY c3;
67
--echo ==== clean up ====
70
sync_slave_with_master;