mirror of
https://github.com/MariaDB/server.git
synced 2025-12-09 08:01:34 +03:00
Major replication test framework cleanup. This does the following:
- Ensure that all tests clean up the replication state when they
finish, by making check-testcase check the output of SHOW SLAVE STATUS.
This implies:
- Slave must not be running after test finished. This is good
because it removes the risk for sporadic errors in subsequent
tests when a test forgets to sync correctly.
- Slave SQL and IO errors must be cleared when test ends. This is
good because we will notice if a test gets an unexpected error in
the slave threads near the end.
- We no longer have to clean up before a test starts.
- Ensure that all tests that wait for an error in one of the slave
threads waits for a specific error. It is no longer possible to
source wait_for_slave_[sql|io]_to_stop.inc when there is an error
in one of the slave threads. This is good because:
- If a test expects an error but there is a bug that causes
another error to happen, or if it stops the slave thread without
an error, then we will notice.
- When developing tests, wait_for_*_to_[start|stop].inc will fail
immediately if there is an error in the relevant slave thread.
Before this patch, we had to wait for the timeout.
- Remove duplicated and repeated code for setting up unusual replication
topologies. Now, there is a single file that is capable of setting
up arbitrary topologies (include/rpl_init.inc, but
include/master-slave.inc is still available for the most common
topology). Tests can now end with include/rpl_end.inc, which will clean
up correctly no matter what topology is used. The topology can be
changed with include/rpl_change_topology.inc.
- Improved debug information when tests fail. This includes:
- debug info is printed on all servers configured by include/rpl_init.inc
- User can set $rpl_debug=1, which makes auxiliary replication files
print relevant debug info.
- Improved documentation for all auxiliary replication files. Now they
describe purpose, usage, parameters, and side effects.
- Many small code cleanups:
- Made have_innodb.inc output a sensible error message.
- Moved contents of rpl000017-slave.sh into rpl000017.test
- Added mysqltest variables that expose the current state of
disable_warnings/enable_warnings and friends.
- Too many to list here: see per-file comments for details.
98 lines
2.8 KiB
Plaintext
98 lines
2.8 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/have_innodb.inc;
|
|
|
|
--let $rpl_topology= 1->2->1
|
|
--source include/rpl_init.inc
|
|
|
|
# now we test it
|
|
|
|
connection server_2;
|
|
|
|
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 server_1
|
|
|
|
#
|
|
# 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 server_2
|
|
|
|
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 server_1;
|
|
|
|
# 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 server_1;
|
|
|
|
create table t4 (n int); # create 3 ignored events
|
|
create table t5 (n int);
|
|
create table t6 (n int);
|
|
|
|
--sync_slave_with_master server_2
|
|
|
|
# then BUG#13023 caused hang below ("master" looks behind, while it's
|
|
# not in terms of updates done).
|
|
--sync_slave_with_master server_1
|
|
|
|
show tables;
|
|
|
|
# cleanup
|
|
drop table t1, t2, t3, t4, t5, t6;
|
|
--source include/rpl_end.inc
|