From 73ded84c0aeec5755dcb870111ee1af68030bd21 Mon Sep 17 00:00:00 2001 From: "cbell/Chuck@mysql_cab_desk." <> Date: Fri, 30 Mar 2007 11:08:19 -0400 Subject: [PATCH] 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. --- mysql-test/include/rpl_events.inc | 18 ++++++++++++++++-- mysql-test/r/rpl_events.result | 30 ++++++++++++++++++++++++++---- sql/lex.h | 1 - sql/sql_yacc.yy | 2 +- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/mysql-test/include/rpl_events.inc b/mysql-test/include/rpl_events.inc index b8fac61c383..d94a69ad60d 100644 --- a/mysql-test/include/rpl_events.inc +++ b/mysql-test/include/rpl_events.inc @@ -15,8 +15,7 @@ drop table if exists t1,t2; eval CREATE TABLE `t1` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `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`) ) ENGINE=$engine_type DEFAULT CHARSET=utf8; @@ -99,6 +98,21 @@ sync_slave_with_master; --echo "in the slave" 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" connection master; DROP TABLE t1; diff --git a/mysql-test/r/rpl_events.result b/mysql-test/r/rpl_events.result index 332d8cf1c0c..1233ab1b9d2 100644 --- a/mysql-test/r/rpl_events.result +++ b/mysql-test/r/rpl_events.result @@ -11,8 +11,7 @@ drop table if exists t1,t2; CREATE TABLE `t1` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `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`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO t1 (c) VALUES ('manually'); @@ -69,6 +68,18 @@ db name status originator "in the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; 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" DROP TABLE t1; set binlog_format=statement; @@ -77,8 +88,7 @@ drop table if exists t1,t2; CREATE TABLE `t1` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `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`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO t1 (c) VALUES ('manually'); @@ -135,5 +145,17 @@ db name status originator "in the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; 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" DROP TABLE t1; diff --git a/sql/lex.h b/sql/lex.h index 6e0f1c711f2..45155da7692 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -467,7 +467,6 @@ static SYMBOL symbols[] = { { "SIGNED", SYM(SIGNED_SYM)}, { "SIMPLE", SYM(SIMPLE_SYM)}, { "SLAVE", SYM(SLAVE)}, - { "SLAVESIDE_DISABLE", SYM(SLAVESIDE_DISABLE_SYM)}, { "SNAPSHOT", SYM(SNAPSHOT_SYM)}, { "SMALLINT", SYM(SMALLINT)}, { "SOCKET", SYM(SOCKET_SYM)}, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 03123617e33..36b09224796 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1774,7 +1774,7 @@ opt_ev_status: /* empty */ { $$= 0; } Lex->event_parse_data->status= Event_basic::ENABLED; $$= 1; } - | SLAVESIDE_DISABLE_SYM + | DISABLE_SYM ON SLAVE { Lex->event_parse_data->status= Event_basic::SLAVESIDE_DISABLED; $$= 1;