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.
108 lines
2.3 KiB
Plaintext
108 lines
2.3 KiB
Plaintext
#
|
|
# Test of replicating user variables
|
|
#
|
|
###########################################################
|
|
# 2006-02-08 By JBM added order by for use w/ NDB engine
|
|
###########################################################
|
|
source include/master-slave.inc;
|
|
|
|
#save_master_pos;
|
|
#connection slave;
|
|
#sync_with_master;
|
|
#reset master;
|
|
#connection master;
|
|
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
|
|
create table t1(n char(30));
|
|
|
|
prepare stmt1 from 'insert into t1 values (?)';
|
|
set @var1= "from-master-1";
|
|
execute stmt1 using @var1;
|
|
set @var1= "from-master-2-'',";
|
|
execute stmt1 using @var1;
|
|
SELECT * FROM t1 ORDER BY n;
|
|
|
|
set @var2= 'insert into t1 values (concat("from-var-", ?))';
|
|
prepare stmt2 from @var2;
|
|
set @var1='from-master-3';
|
|
execute stmt2 using @var1;
|
|
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
SELECT * FROM t1 ORDER BY n;
|
|
|
|
connection master;
|
|
|
|
drop table t1;
|
|
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
stop slave;
|
|
|
|
# End of 4.1 tests
|
|
|
|
#
|
|
# Bug #25843 Changing default database between PREPARE and EXECUTE of statement
|
|
# breaks binlog.
|
|
#
|
|
# There were actually two problems discovered by this bug:
|
|
#
|
|
# 1. Default (current) database is not fixed at the creation time.
|
|
# That leads to wrong output of DATABASE() function.
|
|
#
|
|
# 2. Database attributes (@@collation_database) are not fixed at the creation
|
|
# time. That leads to wrong resultset.
|
|
#
|
|
# Binlog breakage and Query Cache wrong output happened because of the first
|
|
# problem.
|
|
#
|
|
|
|
--echo
|
|
--echo ########################################################################
|
|
--echo #
|
|
--echo # BUG#25843: Changing default database between PREPARE and EXECUTE of
|
|
--echo # statement breaks binlog.
|
|
--echo #
|
|
--echo ########################################################################
|
|
|
|
###############################################################################
|
|
|
|
--echo # Connection: slave
|
|
--connection slave
|
|
|
|
START SLAVE;
|
|
|
|
--echo # Connection: master
|
|
--connection master
|
|
|
|
CREATE DATABASE mysqltest1;
|
|
CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
|
|
|
|
PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
|
|
|
|
EXECUTE stmt_d_1;
|
|
|
|
use mysqltest1;
|
|
|
|
EXECUTE stmt_d_1;
|
|
|
|
--echo # Connection: slave
|
|
--sync_slave_with_master
|
|
|
|
SELECT * FROM t1;
|
|
|
|
--echo # Connection: master
|
|
--connection master
|
|
|
|
DROP DATABASE mysqltest1;
|
|
|
|
use test;
|
|
DROP TABLE t1;
|
|
|
|
--source include/rpl_end.inc
|