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.
187 lines
3.8 KiB
Plaintext
187 lines
3.8 KiB
Plaintext
# NYI - row-based cannot use CREATE ... SELECT
|
|
|
|
source include/master-slave.inc;
|
|
--disable_warnings
|
|
drop table if exists t1,v1;
|
|
drop view if exists t1,v1;
|
|
sync_slave_with_master;
|
|
reset master;
|
|
--enable_warnings
|
|
|
|
#
|
|
# Check that creation drop of view is replicated, also check replication of
|
|
# updating of view
|
|
#
|
|
connection master;
|
|
create table t1 (a int);
|
|
insert into t1 values (1);
|
|
create view v1 as select a from t1;
|
|
insert into v1 values (2);
|
|
select * from v1 order by a;
|
|
sync_slave_with_master;
|
|
# view already have to be on slave
|
|
select * from v1 order by a;
|
|
connection master;
|
|
update v1 set a=3 where a=1;
|
|
select * from v1 order by a;
|
|
sync_slave_with_master;
|
|
select * from v1 order by a;
|
|
connection master;
|
|
delete from v1 where a=2;
|
|
select * from v1 order by a;
|
|
sync_slave_with_master;
|
|
select * from v1 order by a;
|
|
connection master;
|
|
# 'alter view' internally maped to creation, but still check that it works
|
|
alter view v1 as select a as b from t1;
|
|
sync_slave_with_master;
|
|
select * from v1 order by 1;
|
|
connection master;
|
|
drop view v1;
|
|
sync_slave_with_master;
|
|
#error, because view have to be removed from slave
|
|
-- error 1146
|
|
select * from v1 order by a;
|
|
connection master;
|
|
drop table t1;
|
|
sync_slave_with_master;
|
|
# Change Author: JBM
|
|
# Change Date: 2005-12-22
|
|
# Change: Commented out binlog events to work with SBR and RBR
|
|
#--replace_column 2 # 5 #
|
|
# show binlog events limit 1,100;
|
|
|
|
#
|
|
# BUG#20438: CREATE statements for views, stored routines and triggers can be
|
|
# not replicable.
|
|
#
|
|
|
|
--echo
|
|
--echo ---> Test for BUG#20438
|
|
|
|
# Prepare environment.
|
|
|
|
--echo
|
|
--echo ---> Preparing environment...
|
|
--echo ---> connection: master
|
|
--connection master
|
|
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP VIEW IF EXISTS v1;
|
|
--enable_warnings
|
|
|
|
--echo
|
|
--echo ---> Synchronizing slave with master...
|
|
|
|
--save_master_pos
|
|
--connection slave
|
|
--sync_with_master
|
|
|
|
--echo
|
|
--echo ---> connection: master
|
|
--connection master
|
|
|
|
# Test.
|
|
|
|
--echo
|
|
--echo ---> Creating objects...
|
|
|
|
CREATE TABLE t1(c INT);
|
|
|
|
/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
|
|
|
|
--echo
|
|
--echo ---> Inserting value...
|
|
|
|
INSERT INTO t1 VALUES(1);
|
|
|
|
--echo
|
|
--echo ---> Checking on master...
|
|
|
|
SELECT * FROM t1;
|
|
|
|
--echo
|
|
--echo ---> Synchronizing slave with master...
|
|
|
|
--save_master_pos
|
|
--connection slave
|
|
--sync_with_master
|
|
|
|
--echo ---> connection: master
|
|
|
|
--echo
|
|
--echo ---> Checking on slave...
|
|
|
|
SELECT * FROM t1;
|
|
|
|
# Cleanup.
|
|
|
|
--echo
|
|
--echo ---> connection: master
|
|
--connection master
|
|
|
|
--echo
|
|
--echo ---> Cleaning up...
|
|
|
|
DROP VIEW v1;
|
|
DROP TABLE t1;
|
|
|
|
--save_master_pos
|
|
--connection slave
|
|
--sync_with_master
|
|
--connection master
|
|
|
|
#
|
|
# BUG#19419: "VIEW: View that the column name is different
|
|
# by master and slave is made".
|
|
#
|
|
connection master;
|
|
create table t1(a int, b int);
|
|
insert into t1 values (1, 1), (1, 2), (1, 3);
|
|
create view v1(a, b) as select a, sum(b) from t1 group by a;
|
|
|
|
sync_slave_with_master;
|
|
explain v1;
|
|
show create table v1;
|
|
select * from v1;
|
|
|
|
connection master;
|
|
drop table t1;
|
|
drop view v1;
|
|
|
|
sync_slave_with_master;
|
|
|
|
#
|
|
# BUG#28244 CREATE VIEW breaks replication when view exists
|
|
#
|
|
connection master;
|
|
CREATE TABLE t1(a INT);
|
|
CREATE VIEW v1 AS SELECT * FROM t1;
|
|
--error ER_TABLE_EXISTS_ERROR
|
|
CREATE VIEW v1 AS SELECT * FROM t1;
|
|
DROP VIEW v1;
|
|
DROP TABLE t1;
|
|
sync_slave_with_master;
|
|
|
|
#
|
|
# Bug#32575 Parse error of stmt with extended comments on slave side
|
|
# Verify that 'CREATE VIEW' with comments is properly logged to binlog
|
|
connection master;
|
|
CREATE TABLE t1 (a INT);
|
|
--echo # create view as output from mysqldump 10.11 (5.0.62)
|
|
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
|
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
|
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */
|
|
/*!50002 WITH CASCADED CHECK OPTION */;
|
|
SHOW CREATE VIEW v1;
|
|
sync_slave_with_master;
|
|
SHOW CREATE VIEW v1;
|
|
connection master;
|
|
DROP VIEW v1;
|
|
DROP TABLE t1;
|
|
sync_slave_with_master;
|
|
|
|
--echo End of 5.0 tests
|
|
--source include/rpl_end.inc
|