1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00
Files
mariadb/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
cc05440836 Bug #49741 test files contain explicit references to bin/relay-log positions
Some of the test cases reference to binlog position and
these position numbers are written into result explicitly.
It is difficult to maintain if log event format changes. 

There are a couple of cases explicit position number appears, 
we handle them in different ways
A. 'CHANGE MASTER ...' with MASTER_LOG_POS or/and RELAY_LOG_POS options
   Use --replace_result to mask them.
B. 'SHOW BINLOG EVENT ...'
   Replaced by show_binlog_events.inc or wait_for_binlog_event.inc. 
   show_binlog_events.inc file's function is enhanced by given
   $binlog_file and $binlog_limit.
C. 'SHOW SLAVE STATUS', 'show_slave_status.inc' and 'show_slave_status2.inc'
   For the test cases just care a few items in the result of 'SHOW SLAVE STATUS',
   only the items related to each test case are showed.
   'show_slave_status.inc' is rebuild, only the given items in $status_items
   will be showed.
   'check_slave_is_running.inc' and 'check_slave_no_error.inc'
   and 'check_slave_param.inc' are auxiliary files helping
   to show running status and error information easily.
2010-05-24 21:54:08 +08:00

115 lines
3.2 KiB
Plaintext

# This test checks that in a dual-head setup
# A->B->A, where A has --log-slave-updates (why would it?
# assume that there is a C as slave of A),
# then the Exec_master_log_pos of SHOW SLAVE STATUS does
# not stay too low on B(BUG#13023 due to events ignored because
# of their server id).
# It also will test BUG#13861.
source include/master-slave.inc;
source include/have_innodb.inc;
# set up "dual head"
# Needed for debug info in wait_for_slave_sql_to_stop.
let $master_connection= slave;
connection slave;
reset master;
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root";
source include/start_slave.inc;
# now we test it
connection slave;
create table t1 (n int);
let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
let $master_log_pos_1= `SELECT $master_log_pos_1 + 3`;
sync_slave_with_master master;
#
# BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
# log-slave-updates and circul repl
#
source include/stop_slave.inc;
create table t2 (n int); # create one ignored event
sync_slave_with_master;
show tables;
create table t3 (n int) engine=innodb;
let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
let $master_log_pos_2= `SELECT $master_log_pos_2 + 5`;
set @a=1;
insert into t3 values(@a);
let $master_log_pos_3= query_get_value(SHOW MASTER STATUS, Position, 1);
let $master_log_pos_3= `SELECT $master_log_pos_3 + 5`;
begin;
insert into t3 values(2);
insert into t3 values(3);
commit;
insert into t3 values(4);
connection master;
# bug is that START SLAVE UNTIL may stop too late, we test that by
# asking it to stop before creation of t3.
--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS
eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_1;
--source include/wait_for_slave_sql_to_stop.inc
# then BUG#13861 causes t3 to show up below (because stopped too
# late).
show tables;
# ensure that we do not break set @a=1; insert into t3 values(@a);
--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS
eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_2;
--source include/wait_for_slave_sql_to_stop.inc
select * from t3;
# ensure that we do not break transaction
--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_3 MASTER_LOG_POS
eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_3;
--source include/wait_for_slave_sql_to_stop.inc
select * from t3;
source include/start_slave.inc;
# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
connection master;
create table t4 (n int); # create 3 ignored events
create table t5 (n int);
create table t6 (n int);
sync_slave_with_master;
sync_slave_with_master master;
# then BUG#13023 caused hang below ("master" looks behind, while it's
# not in terms of updates done).
show tables;
# cleanup
source include/stop_slave.inc;
reset slave;
drop table t1,t2,t3,t4,t5,t6;
sync_slave_with_master;
# End of 4.1 tests