mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
78c8bfdddf
Problem 1: tests often fail in pushbuild with a timeout when waiting for the slave to start/stop/receive error. Fix 1: Updated the wait_for_slave_* macros in the following way: - The timeout is increased by a factor ten - Refactored the macros so that wait_for_slave_param does the work for the other macros. Problem 2: Tests are often incorrectly written, lacking a source include/wait_for_slave_to_[start|stop].inc. Fix 2: Improved the chance to get it right by adding include/start_slave.inc and include/stop_slave.inc, and updated tests to use these. Problem 3: The the built-in test language command wait_for_slave_to_stop is a misnomer (does not wait for the slave io thread) and does not give as much debug info in case of failure as the otherwise equivalent macro source include/wait_for_slave_sql_to_stop.inc Fix 3: Replaced all calls to the built-in command by a call to the macro. Problem 4: Some, but not all, of the wait_for_slave_* macros had an implicit connection slave. This made some tests confusing to read, and made it more difficult to use the macro in circular replication scenarios, where the connection named master needs to wait. Fix 4: Removed the implicit connection slave from all wait_for_slave_* macros, and updated tests to use an explicit connection slave where necessary. Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc were unused. Moreover, using them is difficult and error-prone. Fix 5: remove these macros. Problem 6: log_bin_trust_function_creators_basic failed when running tests because it assumed @@global.log_bin_trust_function_creators=1, and some tests modified this variable without resetting it to its original value. Fix 6: All tests that use this variable have been updated so that they reset the value at end of test.
123 lines
2.5 KiB
Text
123 lines
2.5 KiB
Text
# 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"
|
|
|
|
let $slave_keep_connection= 1;
|
|
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";
|
|
|
|
start slave;
|
|
|
|
# now we test it
|
|
|
|
connection slave;
|
|
|
|
create table t1 (n int);
|
|
|
|
save_master_pos;
|
|
connection master;
|
|
sync_with_master;
|
|
|
|
#
|
|
# BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
|
|
# log-slave-updates and circul repl
|
|
#
|
|
stop slave;
|
|
|
|
create table t2 (n int); # create one ignored event
|
|
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
|
|
connection slave;
|
|
|
|
show tables;
|
|
|
|
save_master_pos;
|
|
|
|
create table t3 (n int) engine=innodb;
|
|
set @a=1;
|
|
insert into t3 values(@a);
|
|
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.
|
|
|
|
start slave until master_log_file="slave-bin.000001",master_log_pos=195;
|
|
--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);
|
|
start slave until master_log_file="slave-bin.000001",master_log_pos=438;
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
|
select * from t3;
|
|
|
|
# ensure that we do not break transaction
|
|
start slave until master_log_file="slave-bin.000001",master_log_pos=663;
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
|
select * from t3;
|
|
|
|
start slave;
|
|
|
|
# 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);
|
|
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
|
|
connection slave;
|
|
|
|
save_master_pos;
|
|
|
|
connection master;
|
|
|
|
# then BUG#13023 caused hang below ("master" looks behind, while it's
|
|
# not in terms of updates done).
|
|
|
|
sync_with_master;
|
|
|
|
show tables;
|
|
|
|
# cleanup
|
|
|
|
stop slave;
|
|
reset slave;
|
|
drop table t1,t2,t3,t4,t5,t6;
|
|
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
|
|
# End of 4.1 tests
|