polardbxengine/mysql-test/suite/ndb_rpl/t/ndb_rpl_apply_status.test

147 lines
3.3 KiB
Plaintext

-- source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source suite/ndb_rpl/ndb_master-slave.inc
#
# Bug#28170 replicate-ignore-db=mysql should not ignore mysql.ndb_apply_status
#
# Slave is started with --replicate-ignore-db=mysql
#
sync_slave_with_master;
echo *** on slave there should be zero rows ***;
select count(*) from mysql.ndb_apply_status;
connection master;
create table t1 (a int key, b int) engine ndb;
insert into t1 values (1,1);
echo *** on master it should be empty ***;
#filter away stuff put there with server_id = 0 (from ndb_restore)
select * from mysql.ndb_apply_status where server_id <> 0;
sync_slave_with_master;
echo *** on slave there should be one row ***;
select count(*) from mysql.ndb_apply_status;
connection master;
drop table t1;
sync_slave_with_master;
connection master;
--echo *** Test reset slave clearing ndb_apply_status ***
create table test.t1 (a int primary key) engine=ndb;
insert into test.t1 values (1);
sync_slave_with_master;
connection slave;
--echo Add a dummy entry
insert into mysql.ndb_apply_status values (999, 9677, 'CaramelLog', 1977, 2015);
select count(1) from mysql.ndb_apply_status;
--echo *** Standard reset slave should clear ndb_apply_status ***
stop slave;
reset slave;
select count(1) from mysql.ndb_apply_status;
--connection master
reset master;
--source include/rpl_start_slaves.inc
--echo *** Test reset slave all ***
insert into test.t1 values (2);
sync_slave_with_master;
connection slave;
--echo Add a dummy entry
insert into mysql.ndb_apply_status values (999, 9677, 'CaramelLog', 1977, 2015);
select count(1) from mysql.ndb_apply_status;
--echo *** Reset slave all should clear ndb_apply_status ***
stop slave;
reset slave all;
select count(1) from mysql.ndb_apply_status;
--connection master
reset master;
--echo RESET SLAVE ALL zapped Master info - re-set it.
--let $rpl_unconditional_change_master=1
--source include/rpl_change_topology.inc
--source include/rpl_start_slaves.inc
--connection slave
--echo *** Test effect of ndb_clear_apply_status = 0 ***
set global ndb_clear_apply_status=0;
--connection master
insert into test.t1 values (3);
sync_slave_with_master;
connection slave;
--echo Add a dummy entry
insert into mysql.ndb_apply_status values (999, 9677, 'CaramelLog', 1977, 2015);
select count(1) from mysql.ndb_apply_status;
--echo *** Standard reset slave should NOT clear ndb_apply_status ***
stop slave;
reset slave;
select count(1) from mysql.ndb_apply_status;
delete from mysql.ndb_apply_status;
--connection master
reset master;
--source include/rpl_start_slaves.inc
--connection master
--echo *** Test reset slave all ***
insert into test.t1 values (4);
sync_slave_with_master;
connection slave;
--echo Add a dummy entry
insert into mysql.ndb_apply_status values (999, 9677, 'CaramelLog', 1977, 2015);
select count(1) from mysql.ndb_apply_status;
--echo *** Reset slave all should NOT clear ndb_apply_status ***
stop slave;
reset slave all;
select count(1) from mysql.ndb_apply_status;
--connection master
reset master;
--echo RESET SLAVE ALL zapped Master info - re-set it.
--let $rpl_unconditional_change_master=1
--source include/rpl_change_topology.inc
--source include/rpl_start_slaves.inc
--connection slave
set global ndb_clear_apply_status=1;
--connection master
drop table test.t1;
sync_slave_with_master;
--source include/rpl_end.inc