Commit d559d8dd authored by unknown's avatar unknown

BUG#28991 : rpl_events failure in pushbuild

This patch contains enhancements to the rpl_events test to correct
timing issues related to the firing of events and verification of the
results of those events. 


mysql-test/include/rpl_events.inc:
  BUG#28991 : rpl_events failure in pushbuild 
  
  This patch contains refinements to the rpl_events test to remove all
  timing issues related to sleep commands. It also refines the test to
  include additional documentation.
mysql-test/r/rpl_events.result:
  BUG#28991 : rpl_events failure in pushbuild 
  
  This patch contains the result file for the refinements to the 
  rpl_events test.
parent 78644117
...@@ -13,52 +13,63 @@ drop table if exists t1,t2; ...@@ -13,52 +13,63 @@ drop table if exists t1,t2;
# first, we need a table to record something from an event # first, we need a table to record something from an event
eval CREATE TABLE `t1` ( eval CREATE TABLE `t1` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL,
`c` VARCHAR(50) NOT NULL, `c` VARCHAR(50) NOT NULL,
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=$engine_type DEFAULT CHARSET=utf8; ) ENGINE=$engine_type DEFAULT CHARSET=utf8;
INSERT INTO t1 (c) VALUES ('manually'); INSERT INTO t1 (id, c) VALUES (1, 'manually');
# then, we create the event # We create the event so that it inserts exactly 1 row in the table
CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 # A recuring event is used so that we can be sure the event will
(c) VALUES ('from justonce'); # fire regardless of timing delays on the server. Otherwise, it is
# possible for the event to timeout before it has inserted a row.
--echo "Creating event test.justonce on the master"
CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
# Show the event is alive and present on master
--echo "Checking event is active on master"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
# wait 3 seconds, so the event can trigger # Wait until event has fired. We know this because t1 will contain
--real_sleep 3 # the row from the event.
let $wait_condition= let $wait_condition=
SELECT count(*) = 1 FROM t1 WHERE c = 'from justonce'; SELECT COUNT(*) = 1 FROM t1 WHERE c = 'from justonce';
--source include/wait_condition.inc --source include/wait_condition.inc
# check that table t1 contains something # check that table t1 contains something
--echo "in the master" --echo "Checking event data on the master"
--enable_info --enable_info
--replace_column 3 TIMESTAMP --replace_column 3 TIMESTAMP
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; SELECT * FROM t1 ORDER BY id;
--disable_info --disable_info
sync_slave_with_master; sync_slave_with_master;
--echo "in the slave" --echo "Checking event data on the slave"
--enable_info --enable_info
--replace_column 3 TIMESTAMP --replace_column 3 TIMESTAMP
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; SELECT * FROM t1 ORDER BY id;
--disable_info --disable_info
--echo "Checking event is inactive on slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
# Create an event on the slave and check to see what the originator is. # Create an event on the slave and check to see what the originator is.
--echo "Dropping event test.slave_once on the slave"
--disable_warnings --disable_warnings
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
--enable_warnings --enable_warnings
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
INSERT INTO t1(c) VALUES ('from slave_once'); INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
--echo "Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
--echo "Dropping event test.slave_once on the slave"
--disable_warnings --disable_warnings
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
--enable_warnings --enable_warnings
...@@ -66,57 +77,74 @@ DROP EVENT IF EXISTS test.slave_once; ...@@ -66,57 +77,74 @@ DROP EVENT IF EXISTS test.slave_once;
connection master; connection master;
# BUG#20384 - disable events on slave # BUG#20384 - disable events on slave
--echo "Dropping event test.justonce on the master"
--disable_warnings --disable_warnings
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
--enable_warnings --enable_warnings
--echo "Creating event test.er on the master"
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
INSERT INTO t1(c) VALUES ('from er'); INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
--echo "Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
sync_slave_with_master; sync_slave_with_master;
--echo "in the slave" --echo "Checking event status on the slave"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
connection master; connection master;
--echo "in the master" --echo "Altering event test.er on the master"
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
--echo "Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
sync_slave_with_master; sync_slave_with_master;
--echo "in the slave" --echo "Checking event status on the slave"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
connection master; connection master;
--echo "in the master" --echo "Dropping event test.er on the master"
DROP EVENT test.er; DROP EVENT test.er;
--echo "Checking event status on the master"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
--disable_info --disable_info
sync_slave_with_master; sync_slave_with_master;
--echo "in the slave" --echo "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
# test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status # test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status
# on CREATE EVENT # on CREATE EVENT
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND --echo "Creating event test.slave_terminate on the slave"
DO INSERT INTO t1(c) VALUES ('from slave_terminate'); CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
--echo "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
--echo "Dropping event test.slave_terminate on the slave"
DROP EVENT test.slave_terminate; DROP EVENT test.slave_terminate;
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND --echo "Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO
INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
--echo "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
--echo "Dropping event test.slave_terminate on the slave"
DROP EVENT test.slave_terminate; DROP EVENT test.slave_terminate;
--echo "in the master" --echo "Cleanup"
connection master; connection master;
DROP TABLE t1; DROP TABLE t1;
...@@ -9,153 +9,191 @@ set binlog_format=row; ...@@ -9,153 +9,191 @@ set binlog_format=row;
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
drop table if exists t1,t2; drop table if exists t1,t2;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL,
`c` VARCHAR(50) NOT NULL, `c` VARCHAR(50) NOT NULL,
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 (c) VALUES ('manually'); INSERT INTO t1 (id, c) VALUES (1, 'manually');
CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 "Creating event test.justonce on the master"
(c) VALUES ('from justonce'); CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
"Checking event is active on master"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
db name status originator db name status originator
test justonce ENABLED 1 test justonce ENABLED 1
"in the master" "Checking event data on the master"
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; SELECT * FROM t1 ORDER BY id;
id c ts id c ts
1 manually TIMESTAMP 1 manually TIMESTAMP
2 from justonce TIMESTAMP 2 from justonce TIMESTAMP
affected rows: 2 affected rows: 2
"in the slave" "Checking event data on the slave"
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; SELECT * FROM t1 ORDER BY id;
id c ts id c ts
1 manually TIMESTAMP 1 manually TIMESTAMP
2 from justonce TIMESTAMP 2 from justonce TIMESTAMP
affected rows: 2 affected rows: 2
"Checking event is inactive on slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
db name status originator db name status originator
test justonce SLAVESIDE_DISABLED 1
"Dropping event test.slave_once on the slave"
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
INSERT INTO t1(c) VALUES ('from slave_once'); INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
"Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
db name status originator db name status originator
test slave_once ENABLED 2 test slave_once ENABLED 2
"Dropping event test.slave_once on the slave"
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
"Dropping event test.justonce on the master"
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
"Creating event test.er on the master"
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
INSERT INTO t1(c) VALUES ('from er'); INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
"Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
db name status originator body db name status originator body
test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er') test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
"in the slave" "Checking event status on the slave"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
db name status originator body db name status originator body
test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er') test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
"in the master" "Altering event test.er on the master"
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
"Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
db name status originator body db name status originator body
test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er') test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
"in the slave" "Checking event status on the slave"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
db name status originator body db name status originator body
test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er') test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
"in the master" "Dropping event test.er on the master"
DROP EVENT test.er; DROP EVENT test.er;
"Checking event status on the master"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
db name status originator db name status originator
"in the slave" "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
db name status originator db name status originator
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND "Creating event test.slave_terminate on the slave"
DO INSERT INTO t1(c) VALUES ('from slave_terminate'); CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
"Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator db name status originator
test slave_terminate ENABLED 2 test slave_terminate ENABLED 2
"Dropping event test.slave_terminate on the slave"
DROP EVENT test.slave_terminate; DROP EVENT test.slave_terminate;
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND "Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO
INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
"Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator db name status originator
test slave_terminate SLAVESIDE_DISABLED 2 test slave_terminate SLAVESIDE_DISABLED 2
"Dropping event test.slave_terminate on the slave"
DROP EVENT test.slave_terminate; DROP EVENT test.slave_terminate;
"in the master" "Cleanup"
DROP TABLE t1; DROP TABLE t1;
set binlog_format=statement; set binlog_format=statement;
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
drop table if exists t1,t2; drop table if exists t1,t2;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL,
`c` VARCHAR(50) NOT NULL, `c` VARCHAR(50) NOT NULL,
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 (c) VALUES ('manually'); INSERT INTO t1 (id, c) VALUES (1, 'manually');
CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 "Creating event test.justonce on the master"
(c) VALUES ('from justonce'); CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
"Checking event is active on master"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
db name status originator db name status originator
test justonce ENABLED 1 test justonce ENABLED 1
"in the master" "Checking event data on the master"
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; SELECT * FROM t1 ORDER BY id;
id c ts id c ts
1 manually TIMESTAMP 1 manually TIMESTAMP
2 from justonce TIMESTAMP 2 from justonce TIMESTAMP
affected rows: 2 affected rows: 2
"in the slave" "Checking event data on the slave"
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; SELECT * FROM t1 ORDER BY id;
id c ts id c ts
1 manually TIMESTAMP 1 manually TIMESTAMP
2 from justonce TIMESTAMP 2 from justonce TIMESTAMP
affected rows: 2 affected rows: 2
"Checking event is inactive on slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
db name status originator db name status originator
test justonce SLAVESIDE_DISABLED 1
"Dropping event test.slave_once on the slave"
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
INSERT INTO t1(c) VALUES ('from slave_once'); INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
"Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
db name status originator db name status originator
test slave_once ENABLED 2 test slave_once ENABLED 2
"Dropping event test.slave_once on the slave"
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
"Dropping event test.justonce on the master"
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
"Creating event test.er on the master"
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
INSERT INTO t1(c) VALUES ('from er'); INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
"Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
db name status originator body db name status originator body
test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er') test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
"in the slave" "Checking event status on the slave"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
db name status originator body db name status originator body
test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er') test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
"in the master" "Altering event test.er on the master"
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
"Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
db name status originator body db name status originator body
test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er') test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
"in the slave" "Checking event status on the slave"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
db name status originator body db name status originator body
test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er') test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
"in the master" "Dropping event test.er on the master"
DROP EVENT test.er; DROP EVENT test.er;
"Checking event status on the master"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
db name status originator db name status originator
"in the slave" "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
db name status originator db name status originator
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND "Creating event test.slave_terminate on the slave"
DO INSERT INTO t1(c) VALUES ('from slave_terminate'); CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
"Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator db name status originator
test slave_terminate ENABLED 2 test slave_terminate ENABLED 2
"Dropping event test.slave_terminate on the slave"
DROP EVENT test.slave_terminate; DROP EVENT test.slave_terminate;
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND "Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO
INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
"Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator db name status originator
test slave_terminate SLAVESIDE_DISABLED 2 test slave_terminate SLAVESIDE_DISABLED 2
"Dropping event test.slave_terminate on the slave"
DROP EVENT test.slave_terminate; DROP EVENT test.slave_terminate;
"in the master" "Cleanup"
DROP TABLE t1; DROP TABLE t1;
CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR
DO BEGIN DO BEGIN
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment