mirror of
https://github.com/MariaDB/server.git
synced 2025-08-27 13:04:36 +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.
126 lines
3.2 KiB
Plaintext
126 lines
3.2 KiB
Plaintext
# File for specialities regarding replication from or to InnoDB
|
|
# tables.
|
|
|
|
source include/master-slave.inc;
|
|
source include/have_innodb.inc;
|
|
|
|
#
|
|
# Bug#11401: Load data infile 'REPLACE INTO' fails on slave.
|
|
#
|
|
connection master;
|
|
CREATE TABLE t4 (
|
|
id INT(5) unsigned NOT NULL auto_increment,
|
|
name varchar(15) NOT NULL default '',
|
|
number varchar(35) NOT NULL default 'default',
|
|
PRIMARY KEY (id),
|
|
UNIQUE KEY unique_rec (name,number)
|
|
) ENGINE=InnoDB;
|
|
|
|
--disable_warnings
|
|
LOAD DATA
|
|
INFILE '../../std_data/loaddata_pair.dat'
|
|
REPLACE INTO TABLE t4
|
|
(name,number);
|
|
--enable_warnings
|
|
SELECT * FROM t4;
|
|
|
|
sync_slave_with_master;
|
|
SELECT * FROM t4;
|
|
|
|
connection master;
|
|
--disable_warnings
|
|
LOAD DATA
|
|
INFILE '../../std_data/loaddata_pair.dat'
|
|
REPLACE INTO TABLE t4
|
|
(name,number);
|
|
--enable_warnings
|
|
SELECT * FROM t4;
|
|
|
|
sync_slave_with_master;
|
|
SELECT * FROM t4;
|
|
|
|
connection master;
|
|
--disable_query_log
|
|
DROP TABLE t4;
|
|
--enable_query_log
|
|
sync_slave_with_master;
|
|
connection master;
|
|
|
|
# End of 4.1 tests
|
|
|
|
#
|
|
# Bug #26418: Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK
|
|
# on master
|
|
#
|
|
#Note Matthias: to be merged to rpl_ddl.test
|
|
|
|
--source include/not_ndb_default.inc
|
|
|
|
FLUSH LOGS;
|
|
sync_slave_with_master;
|
|
FLUSH LOGS;
|
|
connection master;
|
|
let $engine_type= "InnoDB";
|
|
|
|
--disable_warnings
|
|
DROP DATABASE IF EXISTS mysqltest1;
|
|
--enable_warnings
|
|
|
|
CREATE DATABASE mysqltest1;
|
|
CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
|
|
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
|
|
SET AUTOCOMMIT = 0;
|
|
|
|
sync_slave_with_master;
|
|
--echo -------- switch to slave --------
|
|
connection slave;
|
|
|
|
# We want to verify that the following transactions are written to the
|
|
# binlog, despite the transaction is rolled back. (The should be
|
|
# written to the binlog since they contain non-transactional DROP
|
|
# TEMPORARY TABLE). To see that, we use the auxiliary table t1, which
|
|
# is transactional (InnoDB) on master and MyISAM on slave. t1 should
|
|
# be transactional on master so that the insert into t1 does not cause
|
|
# the transaction to be logged. Since t1 is non-transactional on
|
|
# slave, the change will not be rolled back, so the inserted rows will
|
|
# stay in t1 and we can verify that the transaction was replicated.
|
|
ALTER TABLE mysqltest1.t1 ENGINE = MyISAM;
|
|
SHOW CREATE TABLE mysqltest1.t1;
|
|
|
|
--echo -------- switch to master --------
|
|
connection master;
|
|
INSERT INTO mysqltest1.t1 SET f1= 1;
|
|
DROP TEMPORARY TABLE mysqltest1.tmp;
|
|
ROLLBACK;
|
|
--error ER_NO_SUCH_TABLE
|
|
SHOW CREATE TABLE mysqltest1.tmp;
|
|
# Must return no rows here
|
|
SELECT COUNT(*) FROM mysqltest1.t1;
|
|
|
|
INSERT INTO mysqltest1.t1 SET f1= 2;
|
|
CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
|
|
ROLLBACK;
|
|
SHOW CREATE TABLE mysqltest1.tmp2;
|
|
# Must return no rows here
|
|
SELECT COUNT(*) FROM mysqltest1.t1;
|
|
|
|
sync_slave_with_master;
|
|
--echo -------- switch to slave --------
|
|
connection slave;
|
|
--error ER_NO_SUCH_TABLE
|
|
SHOW CREATE TABLE mysqltest1.tmp;
|
|
--error ER_NO_SUCH_TABLE
|
|
SHOW CREATE TABLE mysqltest1.tmp2;
|
|
# t1 has two rows here: the transaction not rolled back since t1 uses MyISAM
|
|
SELECT COUNT(*) FROM mysqltest1.t1;
|
|
FLUSH LOGS;
|
|
|
|
--echo -------- switch to master --------
|
|
connection master;
|
|
FLUSH LOGS;
|
|
|
|
DROP DATABASE mysqltest1;
|
|
--source include/rpl_end.inc
|
|
|
|
--echo End of 5.1 tests
|