WL#3629 - Replication of Invocation and Invoked Features

This patch removes the SLAVESIDE_DISABLED token from the event status clause
and adds the ability to mark an event as status = SLAVESIDE_DISABLED by using
the syntax DISABLE ON SLAVE instead.

The patch also adds tests to rpl_events to check the new syntax.
parent bb050956
...@@ -15,8 +15,7 @@ drop table if exists t1,t2; ...@@ -15,8 +15,7 @@ drop table if exists t1,t2;
eval CREATE TABLE `t1` ( eval CREATE TABLE `t1` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`c` VARCHAR(50) NOT NULL, `c` VARCHAR(50) NOT NULL,
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=$engine_type DEFAULT CHARSET=utf8; ) ENGINE=$engine_type DEFAULT CHARSET=utf8;
...@@ -99,6 +98,21 @@ sync_slave_with_master; ...@@ -99,6 +98,21 @@ sync_slave_with_master;
--echo "in the slave" --echo "in 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
# on CREATE EVENT
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
DO INSERT INTO t1(c) VALUES ('from slave_terminate');
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
DROP EVENT test.slave_terminate;
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
DROP EVENT test.slave_terminate;
--echo "in the master" --echo "in the master"
connection master; connection master;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -11,8 +11,7 @@ drop table if exists t1,t2; ...@@ -11,8 +11,7 @@ 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 AUTO_INCREMENT,
`c` VARCHAR(50) NOT NULL, `c` VARCHAR(50) NOT NULL,
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
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 (c) VALUES ('manually');
...@@ -69,6 +68,18 @@ db name status originator ...@@ -69,6 +68,18 @@ db name status originator
"in the slave" "in 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
DO INSERT INTO t1(c) VALUES ('from slave_terminate');
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator
test slave_terminate ENABLED 2
DROP EVENT test.slave_terminate;
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator
test slave_terminate SLAVESIDE_DISABLED 2
DROP EVENT test.slave_terminate;
"in the master" "in the master"
DROP TABLE t1; DROP TABLE t1;
set binlog_format=statement; set binlog_format=statement;
...@@ -77,8 +88,7 @@ drop table if exists t1,t2; ...@@ -77,8 +88,7 @@ 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 AUTO_INCREMENT,
`c` VARCHAR(50) NOT NULL, `c` VARCHAR(50) NOT NULL,
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
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 (c) VALUES ('manually');
...@@ -135,5 +145,17 @@ db name status originator ...@@ -135,5 +145,17 @@ db name status originator
"in the slave" "in 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
DO INSERT INTO t1(c) VALUES ('from slave_terminate');
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator
test slave_terminate ENABLED 2
DROP EVENT test.slave_terminate;
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator
test slave_terminate SLAVESIDE_DISABLED 2
DROP EVENT test.slave_terminate;
"in the master" "in the master"
DROP TABLE t1; DROP TABLE t1;
...@@ -467,7 +467,6 @@ static SYMBOL symbols[] = { ...@@ -467,7 +467,6 @@ static SYMBOL symbols[] = {
{ "SIGNED", SYM(SIGNED_SYM)}, { "SIGNED", SYM(SIGNED_SYM)},
{ "SIMPLE", SYM(SIMPLE_SYM)}, { "SIMPLE", SYM(SIMPLE_SYM)},
{ "SLAVE", SYM(SLAVE)}, { "SLAVE", SYM(SLAVE)},
{ "SLAVESIDE_DISABLE", SYM(SLAVESIDE_DISABLE_SYM)},
{ "SNAPSHOT", SYM(SNAPSHOT_SYM)}, { "SNAPSHOT", SYM(SNAPSHOT_SYM)},
{ "SMALLINT", SYM(SMALLINT)}, { "SMALLINT", SYM(SMALLINT)},
{ "SOCKET", SYM(SOCKET_SYM)}, { "SOCKET", SYM(SOCKET_SYM)},
......
...@@ -1774,7 +1774,7 @@ opt_ev_status: /* empty */ { $$= 0; } ...@@ -1774,7 +1774,7 @@ opt_ev_status: /* empty */ { $$= 0; }
Lex->event_parse_data->status= Event_basic::ENABLED; Lex->event_parse_data->status= Event_basic::ENABLED;
$$= 1; $$= 1;
} }
| SLAVESIDE_DISABLE_SYM | DISABLE_SYM ON SLAVE
{ {
Lex->event_parse_data->status= Event_basic::SLAVESIDE_DISABLED; Lex->event_parse_data->status= Event_basic::SLAVESIDE_DISABLED;
$$= 1; $$= 1;
......
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