1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

BUG#49978: Replication tests don't clean up replication state at the end

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.
This commit is contained in:
Sven Sandberg
2010-12-19 18:07:28 +01:00
parent 82e887e3b2
commit 09c80e12c5
740 changed files with 6994 additions and 5608 deletions

View File

@@ -1,5 +1,3 @@
drop table if exists t1, t2, t3, t4;
drop table if exists t1, t2, t3, t4;
start slave;
Got one of the listed errors
start slave;
@@ -14,9 +12,9 @@ create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
Master_Log_File master-bin.000001
Relay_Master_Log_File master-bin.000001
Checking that both slave threads are running.
Master_Log_File = 'master-bin.000001'
Relay_Master_Log_File = 'master-bin.000001'
include/check_slave_is_running.inc
select * from t1;
s
Could not break slave
@@ -38,8 +36,7 @@ drop table temp_table, t3;
insert into t2 values(1234);
set insert_id=1234;
insert into t2 values(NULL);
set global sql_slave_skip_counter=1;
start slave;
include/wait_for_slave_sql_error_and_skip.inc [errno=1062]
purge master logs to 'master-bin.000002';
show master logs;
Log_name master-bin.000002
@@ -57,9 +54,9 @@ show binary logs;
Log_name File_size
master-bin.000003 #
insert into t2 values (65);
Master_Log_File master-bin.000003
Relay_Master_Log_File master-bin.000003
Checking that both slave threads are running.
Master_Log_File = 'master-bin.000003'
Relay_Master_Log_File = 'master-bin.000003'
include/check_slave_is_running.inc
select * from t2;
m
34
@@ -85,9 +82,9 @@ master-bin.000005 # <Binlog_Do_DB> <Binlog_Ignore_DB>
select * from t4;
a
testing temporary tables part 2
Master_Log_File master-bin.000005
Relay_Master_Log_File master-bin.000005
Checking that both slave threads are running.
Master_Log_File = 'master-bin.000005'
Relay_Master_Log_File = 'master-bin.000005'
include/check_slave_is_running.inc
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
@@ -102,3 +99,5 @@ show binlog events in '';
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
purge master logs before now();
End of 5.0 tests
include/stop_slave.inc
CHANGE MASTER TO MASTER_HOST = '';