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.
115 lines
3.5 KiB
Plaintext
115 lines
3.5 KiB
Plaintext
##################################################################
|
|
# Author: Giuseppe #
|
|
# Date: 2006-12-20 #
|
|
# Purpose: To test that event effects are replicated #
|
|
# in both row based and statement based format #
|
|
##################################################################
|
|
|
|
--source include/not_embedded.inc
|
|
--source include/master-slave.inc
|
|
|
|
SET @old_event_scheduler = @@global.event_scheduler;
|
|
set global event_scheduler=1;
|
|
|
|
let $engine_type= MyISAM;
|
|
|
|
set binlog_format=row;
|
|
|
|
# Embedded server doesn't support binlogging
|
|
--source include/rpl_events.inc
|
|
|
|
set binlog_format=statement;
|
|
|
|
# Embedded server doesn't support binlogging
|
|
--source include/rpl_events.inc
|
|
|
|
#
|
|
# Bug #28953 Using events in a replication let the slave crash.
|
|
#
|
|
|
|
connection master;
|
|
|
|
CREATE TABLE t28953 (a INT);
|
|
|
|
DELIMITER |;
|
|
CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR
|
|
DO BEGIN
|
|
select * from t28953;
|
|
END;|
|
|
DELIMITER ;|
|
|
|
|
ALTER EVENT event1 RENAME TO event2;
|
|
|
|
sync_slave_with_master;
|
|
|
|
connection master;
|
|
|
|
DROP EVENT event2;
|
|
|
|
#
|
|
# BUG#44331
|
|
# This test verifies if the definer is consistent between master and slave,
|
|
# when the event is created without the DEFINER clause set explicitly or the
|
|
# DEFINER is set to CURRENT_USER
|
|
#
|
|
CREATE TABLE test.t1(details CHAR(30));
|
|
|
|
CREATE EVENT /*!50000 event44331_1 */
|
|
ON SCHEDULE AT CURRENT_TIMESTAMP
|
|
ON COMPLETION PRESERVE DISABLE
|
|
DO INSERT INTO test.t1 VALUES('event event44331_1 fired - no definer');
|
|
|
|
CREATE DEFINER=CURRENT_USER /*!50000 EVENT event44331_2 */
|
|
ON SCHEDULE AT CURRENT_TIMESTAMP
|
|
ON COMPLETION PRESERVE DISABLE
|
|
DO INSERT INTO test.t1 VALUES('event event44331_2 fired - DEFINER=CURRENT_USER');
|
|
|
|
CREATE DEFINER=CURRENT_USER() EVENT event44331_3
|
|
ON SCHEDULE AT CURRENT_TIMESTAMP
|
|
ON COMPLETION PRESERVE DISABLE
|
|
DO INSERT INTO test.t1 VALUES('event event44331_3 fired - DEFINER=CURRENT_USER() function');
|
|
|
|
DELIMITER |;
|
|
CREATE /*!50000 DEFINER='user44331' */ EVENT event44331_4
|
|
ON SCHEDULE AT CURRENT_TIMESTAMP
|
|
ON COMPLETION PRESERVE DISABLE
|
|
DO INSERT INTO test.t1 VALUES('event event44331_4 fired - DEFINER=user1');
|
|
# Test for bug#50095 Multi-statement including CREATE EVENT causes rotten
|
|
# binlog entry
|
|
SELECT 'ABC';
|
|
SELECT '123'|
|
|
DELIMITER ;|
|
|
|
|
--echo #on master
|
|
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
|
where EVENT_NAME='event44331_1';
|
|
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
|
where EVENT_NAME='event44331_2';
|
|
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
|
where EVENT_NAME='event44331_3';
|
|
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
|
where EVENT_NAME='event44331_4';
|
|
|
|
sync_slave_with_master;
|
|
connection slave;
|
|
--echo #on slave
|
|
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
|
where EVENT_NAME='event44331_1';
|
|
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
|
where EVENT_NAME='event44331_2';
|
|
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
|
where EVENT_NAME='event44331_3';
|
|
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
|
where EVENT_NAME='event44331_4';
|
|
|
|
connection master;
|
|
SET @@global.event_scheduler= @old_event_scheduler;
|
|
DROP TABLE t28953;
|
|
DROP TABLE t1;
|
|
DROP EVENT event44331_1;
|
|
DROP EVENT event44331_2;
|
|
DROP EVENT event44331_3;
|
|
DROP EVENT event44331_4;
|
|
sync_slave_with_master;
|
|
--source include/rpl_end.inc
|