mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
4c798b42d3
mysql-test/include/have_ndb_extra.inc: New BitKeeper file ``mysql-test/include/have_ndb_extra.inc'' mysql-test/include/not_ndb.inc: New BitKeeper file ``mysql-test/include/not_ndb.inc'' mysql-test/r/have_ndb_extra.require: New BitKeeper file ``mysql-test/r/have_ndb_extra.require'' mysql-test/r/ndb_alter_table_row.result: New BitKeeper file ``mysql-test/r/ndb_alter_table_row.result'' mysql-test/r/ndb_alter_table_stm.result: New BitKeeper file ``mysql-test/r/ndb_alter_table_stm.result'' mysql-test/r/ndb_binlog_basic.result: New BitKeeper file ``mysql-test/r/ndb_binlog_basic.result'' mysql-test/r/ndb_binlog_multi.result: New BitKeeper file ``mysql-test/r/ndb_binlog_multi.result'' mysql-test/r/ndb_multi_row.result: New BitKeeper file ``mysql-test/r/ndb_multi_row.result'' mysql-test/r/not_ndb.require: New BitKeeper file ``mysql-test/r/not_ndb.require'' mysql-test/r/rpl_ndb_bank.result: New BitKeeper file ``mysql-test/r/rpl_ndb_bank.result'' mysql-test/r/rpl_ndb_basic.result: New BitKeeper file ``mysql-test/r/rpl_ndb_basic.result'' mysql-test/r/rpl_ndb_disk.result: New BitKeeper file ``mysql-test/r/rpl_ndb_disk.result'' mysql-test/r/rpl_ndb_idempotent.result: New BitKeeper file ``mysql-test/r/rpl_ndb_idempotent.result'' mysql-test/r/rpl_ndb_load.result: New BitKeeper file ``mysql-test/r/rpl_ndb_load.result'' mysql-test/r/rpl_ndb_multi.result: New BitKeeper file ``mysql-test/r/rpl_ndb_multi.result'' mysql-test/r/rpl_ndb_sync.result: New BitKeeper file ``mysql-test/r/rpl_ndb_sync.result'' mysql-test/r/rpl_row_basic_7ndb.result: New BitKeeper file ``mysql-test/r/rpl_row_basic_7ndb.result'' mysql-test/t/ndb_alter_table_row.test: New BitKeeper file ``mysql-test/t/ndb_alter_table_row.test'' mysql-test/t/ndb_alter_table_stm.test: New BitKeeper file ``mysql-test/t/ndb_alter_table_stm.test'' mysql-test/t/ndb_binlog_basic.test: New BitKeeper file ``mysql-test/t/ndb_binlog_basic.test'' mysql-test/t/ndb_binlog_multi.test: New BitKeeper file ``mysql-test/t/ndb_binlog_multi.test'' mysql-test/t/ndb_multi_row.test: New BitKeeper file ``mysql-test/t/ndb_multi_row.test'' mysql-test/t/rpl_ndb_bank.test: New BitKeeper file ``mysql-test/t/rpl_ndb_bank.test'' mysql-test/t/rpl_ndb_basic.test: New BitKeeper file ``mysql-test/t/rpl_ndb_basic.test'' mysql-test/t/rpl_ndb_disk.test: New BitKeeper file ``mysql-test/t/rpl_ndb_disk.test'' mysql-test/t/rpl_ndb_idempotent.test: New BitKeeper file ``mysql-test/t/rpl_ndb_idempotent.test'' mysql-test/t/rpl_ndb_load.test: New BitKeeper file ``mysql-test/t/rpl_ndb_load.test'' mysql-test/t/rpl_ndb_multi.test: New BitKeeper file ``mysql-test/t/rpl_ndb_multi.test'' mysql-test/t/rpl_ndb_sync.test: New BitKeeper file ``mysql-test/t/rpl_ndb_sync.test'' mysql-test/t/rpl_row_basic_7ndb.test: New BitKeeper file ``mysql-test/t/rpl_row_basic_7ndb.test'' sql/ha_ndbcluster_binlog.cc: New BitKeeper file ``sql/ha_ndbcluster_binlog.cc'' sql/ha_ndbcluster_binlog.h: New BitKeeper file ``sql/ha_ndbcluster_binlog.h'' sql/ha_ndbcluster_tables.h: New BitKeeper file ``sql/ha_ndbcluster_tables.h'' sql/rpl_injector.cc: New BitKeeper file ``sql/rpl_injector.cc'' sql/rpl_injector.h: New BitKeeper file ``sql/rpl_injector.h'' storage/ndb/include/kernel/signaldata/DihFragCount.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DihFragCount.hpp''
71 lines
2.1 KiB
Text
71 lines
2.1 KiB
Text
--source include/have_ndb.inc
|
|
--source include/have_multi_ndb.inc
|
|
--source include/have_binlog_format_row.inc
|
|
--source include/master-slave.inc
|
|
|
|
# note: server2 is another "master" connected to the master cluster
|
|
|
|
#
|
|
# Currently test only works with ndb since it retrieves "old"
|
|
# binlog positions with cluster_replication.binlog_index and apply_status;
|
|
#
|
|
|
|
# create a table with one row, and make sure the other "master" gets it
|
|
CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
|
|
connection server2;
|
|
reset master;
|
|
SHOW TABLES;
|
|
connection master;
|
|
INSERT INTO t1 VALUES ("row1","will go away",1);
|
|
SELECT * FROM t1 ORDER BY c3;
|
|
connection server2;
|
|
SELECT * FROM t1 ORDER BY c3;
|
|
|
|
# sync slave and retrieve epoch and stop the slave
|
|
connection master;
|
|
sync_slave_with_master;
|
|
--replace_column 1 <the_epoch>
|
|
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
|
|
let $the_epoch= `select @the_epoch` ;
|
|
SELECT * FROM t1 ORDER BY c3;
|
|
stop slave;
|
|
|
|
# get the master binlog pos from the epoch, from the _other_ "master", server2
|
|
connection server2;
|
|
--replace_result $the_epoch <the_epoch>
|
|
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
|
|
FROM cluster_replication.binlog_index WHERE epoch = $the_epoch ;
|
|
let $the_pos= `SELECT @the_pos` ;
|
|
let $the_file= `SELECT @the_file` ;
|
|
|
|
# now connect the slave to the _other_ "master"
|
|
connection slave;
|
|
--replace_result $MASTER_MYPORT1 <MASTER_PORT1>
|
|
eval CHANGE MASTER TO
|
|
master_port=$MASTER_MYPORT1,
|
|
master_log_file = '$the_file',
|
|
master_log_pos = $the_pos ;
|
|
start slave;
|
|
|
|
# insert some more values on the first master
|
|
connection master;
|
|
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;
|
|
|
|
save_master_pos;
|
|
|
|
# insert another row, and check that we have it on the slave
|
|
connection server2;
|
|
INSERT INTO t1 VALUES ("row5","E",5);
|
|
SELECT * FROM t1 ORDER BY c3;
|
|
#sync_slave_with_master;
|
|
connection slave;
|
|
--sleep 2
|
|
SELECT * FROM t1 ORDER BY c3;
|
|
|
|
STOP SLAVE;
|