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_circular.test

--source include/have_ndb.inc

# set up circular replication
--let $rpl_topology= 1->2->1
--source include/rpl_init.inc

--let $rpl_connection_name= master
--let $rpl_server_number= 1
--source include/rpl_connect.inc

--let $rpl_connection_name= slave
--let $rpl_server_number= 2
--source include/rpl_connect.inc


# create the table on the "slave"
--connection slave
CREATE TABLE t1 (a int key, b int) ENGINE=ndb;
#CREATE TABLE t2 (a int key, b int) ENGINE=ndb;
sync_slave_with_master master;
# now we should have a table on the master as well
SHOW TABLES;

# insert some values on the slave and master
--connection master
INSERT INTO t1 VALUES (1,2);
# Give time to propagate + close epoch, to ensure deterministic Binlog contents
--sleep 1
--connection slave
INSERT INTO t1 VALUES (2,3);

# ensure data has propagated both ways
--connection slave
sync_slave_with_master master;
--sync_slave_with_master

# connect to slave and ensure data it there.
--connection slave
SELECT * FROM t1 ORDER BY a;
#SELECT * FROM t2 ORDER BY a;
# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical show slave status;

--echo Slave Binlog contains all ops as log_slave_updates is on
show variables like 'server_id';
show variables like 'log_bin';
show variables like 'log_slave_updates';
--source include/show_binlog_events2.inc

source include/check_slave_is_running.inc;
# connect to master and ensure data it there.
--connection master
SELECT * FROM t1 ORDER BY a;
#SELECT * FROM t2 ORDER BY a;
source include/check_slave_is_running.inc;

--echo Master Binlog contains only Master ops as log_slave_updates is off
show variables like 'server_id';
show variables like 'log_bin';
show variables like 'log_slave_updates';
--source include/show_binlog_events2.inc

# stop replication on "master" as not to replicate
# shutdown circularly, eg drop table
--connection master
STOP SLAVE;

# cleanup
--connection master
DROP TABLE t1;
-- sync_slave_with_master

# Test ndb_log_apply_status option

--connection master
start slave;
create table t1 (a int primary key, b int) engine=ndb;
show variables like '%log_orig%';

--echo 'Master' has only slave's serverid entry 
select server_id, log_name from mysql.ndb_apply_status order by server_id;

set global ndb_log_apply_status=On;
show variables like 'ndb_log_apply_status';

--connection slave
--echo 'Slave' has only Master's serverid entry
select server_id, log_name from mysql.ndb_apply_status order by server_id;
--echo 'Slave' has following ndb_binlog_index entries
select inserts, updates, deletes, schemaops, orig_server_id from mysql.ndb_binlog_index order by position;

set global ndb_log_apply_status=On;
show variables like 'ndb_log_apply_status';

--connection master

stop slave;
insert into t1 values (1,1);
--sync_slave_with_master

--connection slave
--echo 'Slave' still has only Master's serverid entry
select server_id, log_name from mysql.ndb_apply_status order by server_id;

--disable_result_log
show binlog events;
--enable_result_log
--echo 'Slave' has following ndb_binlog_index entries
select inserts, updates, deletes, schemaops, orig_server_id from mysql.ndb_binlog_index order by position;

--connection master
--echo 'Master' still has only Slave's serverid entry
select server_id, log_name from mysql.ndb_apply_status order by server_id;

start slave;
--connection slave 
--sync_slave_with_master master

--connection master
--echo 'Master' now has own serverid entry as well.
select server_id, log_name from mysql.ndb_apply_status order by server_id;

--connection slave
--echo 'Slave' still only has 'Master''s serverid entry
select server_id, log_name from mysql.ndb_apply_status order by server_id;
--echo Now create event originating at Slave
insert into t1 values (2,2);
--sync_slave_with_master master

--connection master
--sync_slave_with_master slave

--connection slave
--echo 'Slave' now also has its own serverid entry
select server_id, log_name from mysql.ndb_apply_status order by server_id;


--connection master
stop slave;
set global ndb_log_apply_status=off;

--connection slave
set global ndb_log_apply_status=off;
stop slave;

drop table t1;

--connection master

drop table t1;

--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

./BlackJoker Mini Shell 1.0