mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
09c80e12c5
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.
85 lines
2.7 KiB
Text
85 lines
2.7 KiB
Text
# PURPOSE. Test that blackhole works with replication in all three
|
|
# modes: STATEMENT, MIXED, and ROW.
|
|
#
|
|
# METHOD. We start by creating a table on the master and then change
|
|
# the engine to use blackhole on the slave.
|
|
#
|
|
# After insert/update/delete of one or more rows, the test the
|
|
# proceeds to check that replication is running after replicating an
|
|
# change, that the blackhole engine does not contain anything (which
|
|
# is just a check that the correct engine is used), and that something
|
|
# is written to the binary log.
|
|
#
|
|
# Whe check INSERT, UPDATE, and DELETE statement for tables with no
|
|
# key (forcing a range search on the slave), primary keys (using a
|
|
# primary key lookup), and index/key with multiple matches (forcing an
|
|
# index search).
|
|
|
|
source include/master-slave.inc;
|
|
source include/have_blackhole.inc;
|
|
|
|
# We start with no primary key
|
|
CREATE TABLE t1 (a INT, b INT, c INT);
|
|
CREATE TABLE t2 (a INT, b INT, c INT);
|
|
|
|
sync_slave_with_master;
|
|
ALTER TABLE t1 ENGINE=BLACKHOLE;
|
|
|
|
connection master;
|
|
INSERT INTO t2 VALUES (1,9,1), (2,9,2), (3,9,3), (4,9,4);
|
|
sync_slave_with_master;
|
|
|
|
# Test insert, no primary key
|
|
let $statement = INSERT INTO t1 VALUES (1,1,1),(2,1,2),(3,1,3),(4,1,4);
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
# Test update, no primary key
|
|
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 1;
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
# Test delete, no primary key
|
|
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 1;
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
# Test INSERT-SELECT into Blackhole, no primary key
|
|
let $statement = INSERT INTO t1 SELECT * FROM t2;
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
# Test INSERT-SELECT from Blackhole, no primary key
|
|
let $statement = INSERT INTO t2 SELECT * FROM t1;
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
connection master;
|
|
ALTER TABLE t1 ADD PRIMARY KEY pk_t1 (a,b);
|
|
|
|
# Test insert, primary key
|
|
let $statement = INSERT INTO t1 VALUES (1,2,1),(2,2,2),(3,2,3),(4,2,4);
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
# Test update, primary key
|
|
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 2;
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
# Test delete, primary key
|
|
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 2;
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
connection master;
|
|
ALTER TABLE t1 DROP PRIMARY KEY, ADD KEY key_t1 (a);
|
|
|
|
# Test insert, key
|
|
let $statement = INSERT INTO t1 VALUES (1,3,1),(2,3,2),(3,3,3),(4,3,4);
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
# Test update, key
|
|
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 3;
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
# Test delete, key
|
|
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 3;
|
|
source extra/rpl_tests/rpl_blackhole.test;
|
|
|
|
|
|
connection master;
|
|
DROP TABLE t1,t2;
|
|
--source include/rpl_end.inc
|