From 62b41b5fbcf3fe8bd680e28e0064d3194daf4157 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Mar 2007 09:56:57 -0400 Subject: WL#3629 - Replication of Invocation and Invoked Features This changeset adds replication of events and user-defined functions. There are several bug reports involved in this change: BUG#16421, BUG#17857, BUG#20384: This patch modifies the mysql.events table to permit the addition of another enum value for the status column. The column now has values of ('DISABLED','SLAVESIDE_DISABLED','ENABLED'). A status of SLAVESIDE_DISABLED is set on the slave during replication of events. This enables users to determine which events werereplicated from the master and to later enable them if they promote the slave to a master. The CREATE, ALTER, and DROP statements are binlogged. A new test was added for replication of events (rpl_events). BUG#17671: This patch modifies the code to permit logging of user-defined functions. Note: this is the CREATE FUNCTION ... SONAME variety. A more friendly error message to be displayed should a replicated user-defined function not be found in the loadable library or if the library is missing from the slave.The CREATE andDROP statements are binlogged. A new test was added for replication of user-defined functions (rpl_udf). The patch also adds a new column to the mysql.event table named 'originator' that is used to store the server_id of the server that the event originated on. This enables users to promote a slave to a master and later return the promoted slave to a slave and disable the replicated events. mysql-test/lib/init_db.sql: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the SLAVESIDE_DISABLED to the list of enumerated values for the mysql.event table. This patch adds the column 'originator' to the mysql.event table. mysql-test/r/events.result: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the 'originator' column to the events test results. This was necessary to ensure the manual insert into mysql.event table succeeds because the originator column is set to NOT NULL. mysql-test/r/events_grant.result: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the 'originator' column to the events_grant test results. This was necessary to ensure the manual insert into mysql.event table succeeds because the originator column is set to NOT NULL. mysql-test/r/events_restart_phase1.result: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the 'originator' column to the events_restart_phase1 test results. This was necessary to ensure the manual insert into mysql.event table succeeds because the originator column is set to NOT NULL. mysql-test/r/system_mysql_db.result: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the SLAVESIDE_DISABLED to the list of enumerated values for the mysql.event table. This patch adds the column 'originator' to the mysql.event table. These changes to the result file were necessary to ensure correct test results. mysql-test/t/events.test: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the 'originator' column to the events test. This was necessary to ensure the manual insert into mysql.event table succeeds because the originator column is set to NOT NULL. mysql-test/t/events_restart_phase1.test: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the 'originator' column to the events_restart_phase1 test. This was necessary to ensure the manual insert into mysql.event table succeeds because the originator column is set to NOT NULL. scripts/mysql_create_system_tables.sh: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the SLAVESIDE_DISABLED to the list of enumerated values for the mysql.event table. This patch adds the column 'originator' to the mysql.event table. scripts/mysql_fix_privilege_tables.sql: WL#3629 - Replication of Invocation and Invoked Feature This patch adds the SLAVESIDE_DISABLED to the list of enumerated values for the mysql.event table. This patch adds the column 'originator' to the mysql.event table. sql/event_data_objects.cc: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to permit processing of the new enum SLAVESIDE_DISABLED which is set on the slave during replication of events. This patch uses the new Event_basic:: enumerated values. sql/event_data_objects.h: WL#3629 - Replication of Invocation and Invoked Features This patch moves the duplicated enumeration values for ENABLED, SLAVESIDE_DISABLED, and DISABLED to the Event_basic class removing them from the other Event_* classes. sql/event_db_repository.cc: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to permit processing of the new enum SLAVESIDE_DISABLED which is set on the slave during replication of events. The patch also adds a new column to the mysql.event table named 'originator' that is used to store the server_id of the server that the event originated on. This enables users to promote a slave to a master and later return the promoted slave to a slave and disable the replicated events. sql/event_db_repository.h: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to add a new field named 'originator' to the enum_event_table_field and associated structure. sql/event_queue.cc: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to permit processing of the new enum SLAVESIDE_DISABLED which is set on the slave during replication of events. sql/events.cc: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to permit processing of the new enum SLAVESIDE_DISABLED which is set on the slave during replication of events. sql/lex.h: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to add the new SLAVESIDE_DISABLE symbol to the lexical parser. sql/slave.cc: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to permit the capture of the error on the slave when a UDF from a loadable library is not loaded on the server when replicated from the master. sql/sql_parse.cc: WL#3629 - Replication of Invocation and Invoked Features This patch removes the comment because drop functions commands are replicated. sql/sql_show.cc: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to permit processing of the new enum SLAVESIDE_DISABLED which is set on the slave during replication of events. The code also adds changes the display width of the status column for the schema table for the show events command and also adds the new column 'originator' to the events_field_info structure. sql/sql_udf.cc: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to add the binlogging of the create and drop function events. sql/sql_yacc.yy: WL#3629 - Replication of Invocation and Invoked Features This patch modifies the code to change the enumeration of the status column for the events in the parser. The code uses the Event_basic:: enumerations allowing the enums to be defined in one place. mysql-test/t/rpl_events.test: WL#3629 - Replication of Invocation and Invoked Features This patch adds a new test for testing replication of events. The test uses include files so that the test can test under both RBR and SBR. mysql-test/r/rpl_events.result: WL#3629 - Replication of Invocation and Invoked Features This patch adds a new result file for testing replication of events. mysql-test/r/rpl_udf.result: WL#3629 - Replication of Invocation and Invoked Features This patch adds a new result file for testing replication of UDFs. mysql-test/t/rpl_udf.test: WL#3629 - Replication of Invocation and Invoked Features This patch adds a new test for testing replication of UDFs. The test uses include files so that the test can test under both RBR and SBR. mysql-test/include/rpl_events.inc: WL#3629 - Replication of Invocation and Invoked Features This patch adds a new include file for testing replication of events. This file contains the core test procedures. mysql-test/include/rpl_udf.inc: WL#3629 - Replication of Invocation and Invoked Features This patch adds a new include file for testing replication of UDFs. This file contains the core test procedures. --- mysql-test/r/events.result | 29 +-- mysql-test/r/events_grant.result | 24 +-- mysql-test/r/events_restart_phase1.result | 4 +- mysql-test/r/rpl_events.result | 133 +++++++++++++ mysql-test/r/rpl_udf.result | 310 ++++++++++++++++++++++++++++++ mysql-test/r/system_mysql_db.result | 3 +- 6 files changed, 474 insertions(+), 29 deletions(-) create mode 100644 mysql-test/r/rpl_events.result create mode 100644 mysql-test/r/rpl_udf.result (limited to 'mysql-test/r') diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result index af864c57efa..3193f45d554 100644 --- a/mysql-test/r/events.result +++ b/mysql-test/r/events.result @@ -193,7 +193,7 @@ create event SHOW CREATE EVENT руут21; Event sql_mode Create Event руут21 CREATE EVENT `руут21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE COMMENT 'това е 1251 коментар' DO select 1 -insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND"); +insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1); show create event root22; ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND' SHOW EVENTS; @@ -225,18 +225,18 @@ drop event set names latin1; CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator +events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED 1 ALTER TABLE mysql.event ADD dummy INT FIRST; SHOW EVENTS; -ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table probably corrupted +ERROR HY000: Column count of mysql.event is wrong. Expected 17, found 18. Table probably corrupted ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST; SHOW EVENTS; -ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table probably corrupted +ERROR HY000: Column count of mysql.event is wrong. Expected 17, found 18. Table probably corrupted ALTER TABLE mysql.event DROP dummy2; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator +events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED 1 CREATE TABLE event_like LIKE mysql.event; INSERT INTO event_like SELECT * FROM mysql.event; ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; @@ -258,10 +258,11 @@ event CREATE TABLE `event` ( `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, `ends` datetime DEFAULT NULL, - `status` enum('ENABLED','DISABLED') NOT NULL DEFAULT 'ENABLED', + `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `originator` int(10) NOT NULL, PRIMARY KEY (`db`,`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events' SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; @@ -269,8 +270,8 @@ ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error l ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default ''; "This should work" SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator +events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED 1 ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. @@ -279,14 +280,14 @@ SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. ALTER TABLE mysql.event DROP comment, DROP starts; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; -ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 14. Table probably corrupted +ERROR HY000: Column count of mysql.event is wrong. Expected 17, found 15. Table probably corrupted DROP TABLE mysql.event; CREATE TABLE mysql.event like event_like; INSERT INTO mysql.event SELECT * FROM event_like; DROP TABLE event_like; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator +events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED 1 DROP EVENT intact_check; create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; @@ -399,5 +400,5 @@ ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa SHOW EVENTS FROM ``; ERROR 42000: Incorrect database name '' SHOW EVENTS FROM `events\\test`; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator drop database events_test; diff --git a/mysql-test/r/events_grant.result b/mysql-test/r/events_grant.result index a28c30a9345..87906216e40 100644 --- a/mysql-test/r/events_grant.result +++ b/mysql-test/r/events_grant.result @@ -2,8 +2,8 @@ CREATE DATABASE IF NOT EXISTS events_test; use events_test; CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator +events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED 1 SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE @@ -29,8 +29,8 @@ ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_te USE events_test; "We should see one event"; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator +events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED 1 SELECT CONCAT("Let's create some new events from the name of ", USER()); CONCAT("Let's create some new events from the name of ", USER()) Let's create some new events from the name of ev_test@localhost @@ -40,18 +40,18 @@ CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE CO CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123; "Now we should see 3 events:"; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED -events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED -events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator +events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED 1 +events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED 1 +events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED 1 "This should show us only 2 events:"; SHOW EVENTS LIKE 't%event'; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED -events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator +events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED 1 +events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED 1 "This should show us no events:"; SHOW EVENTS FROM test LIKE '%'; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Originator GRANT EVENT ON events_test2.* TO ev_test@localhost; USE events_test2; CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; diff --git a/mysql-test/r/events_restart_phase1.result b/mysql-test/r/events_restart_phase1.result index a7a46fa0ab1..2b0f4141c7c 100644 --- a/mysql-test/r/events_restart_phase1.result +++ b/mysql-test/r/events_restart_phase1.result @@ -7,6 +7,6 @@ create event abc2 on schedule every 1 second do insert into execution_log value( create event abc3 on schedule every 1 second do insert into execution_log value('abc3'); select name from execution_log; name -insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1'); -insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2'); +insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1',1); +insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2',1); "Now we restart the server" diff --git a/mysql-test/r/rpl_events.result b/mysql-test/r/rpl_events.result new file mode 100644 index 00000000000..59bd16adbf6 --- /dev/null +++ b/mysql-test/r/rpl_events.result @@ -0,0 +1,133 @@ +set global event_scheduler=1; +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +set binlog_format=row; +DROP EVENT IF EXISTS justonce; +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, +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 (c) VALUES ('manually'); +CREATE EVENT justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTo t1 +(c) VALUES ('from justonce'); +"in the master" +SELECT * FROM t1; +id c ts +1 manually TIMESTAMP +2 from justonce TIMESTAMP +affected rows: 2 +"in the slave" +SELECT * FROM t1; +id c ts +1 manually TIMESTAMP +2 from justonce TIMESTAMP +affected rows: 2 +DROP EVENT IF EXISTS test.slave_once; +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +INSERT INTO t1(c) VALUES ('from slave_once'); +SELECT db, name, status, originator FROM mysql.event; +db name status originator +test justonce SLAVESIDE_DISABLED 1 +test slave_once ENABLED 2 +DROP EVENT IF EXISTS test.slave_once; +DROP EVENT IF EXISTS test.justonce; +Warnings: +Note 1305 Event justonce does not exist +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +INSERT INTO t1(c) VALUES ('from er'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +test er ENABLED 1 +"in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +test er SLAVESIDE_DISABLED 1 +"in the master" +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +test er ENABLED 1 +"in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +test er SLAVESIDE_DISABLED 1 +"in the master" +DROP EVENT test.er; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +"in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +"in the master" +DROP TABLE t1; +set binlog_format=statement; +DROP EVENT IF EXISTS justonce; +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, +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 (c) VALUES ('manually'); +CREATE EVENT justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTo t1 +(c) VALUES ('from justonce'); +"in the master" +SELECT * FROM t1; +id c ts +1 manually TIMESTAMP +2 from justonce TIMESTAMP +affected rows: 2 +"in the slave" +SELECT * FROM t1; +id c ts +1 manually TIMESTAMP +2 from justonce TIMESTAMP +affected rows: 2 +DROP EVENT IF EXISTS test.slave_once; +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +INSERT INTO t1(c) VALUES ('from slave_once'); +SELECT db, name, status, originator FROM mysql.event; +db name status originator +test justonce SLAVESIDE_DISABLED 1 +test slave_once ENABLED 2 +DROP EVENT IF EXISTS test.slave_once; +DROP EVENT IF EXISTS test.justonce; +Warnings: +Note 1305 Event justonce does not exist +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +INSERT INTO t1(c) VALUES ('from er'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +test er ENABLED 1 +"in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +test er SLAVESIDE_DISABLED 1 +"in the master" +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +test er ENABLED 1 +"in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +test er SLAVESIDE_DISABLED 1 +"in the master" +DROP EVENT test.er; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +"in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator +"in the master" +DROP TABLE t1; diff --git a/mysql-test/r/rpl_udf.result b/mysql-test/r/rpl_udf.result new file mode 100644 index 00000000000..156876d07de --- /dev/null +++ b/mysql-test/r/rpl_udf.result @@ -0,0 +1,310 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +set binlog_format=row; +drop table if exists t1; +"*** Test 1) Test UDFs via loadable libraries *** +"Running on the master" +CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +affected rows: 0 +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +affected rows: 0 +CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +ERROR HY000: Can't find symbol 'myfunc_nonexist' in library +SELECT * FROM mysql.func; +name ret dl type +myfunc_double 1 udf_example.dll function +myfunc_int 2 udf_example.dll function +affected rows: 2 +"Running on the slave" +SELECT * FROM mysql.func; +name ret dl type +myfunc_double 1 udf_example.dll function +myfunc_int 2 udf_example.dll function +affected rows: 2 +"Running on the master" +CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; +affected rows: 0 +INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00)); +affected rows: 1 +SELECT * FROM t1 ORDER BY sum; +sum price +1 48.5 +10 48.75 +100 48.6 +200 49 +affected rows: 4 +"Running on the slave" +SELECT * FROM t1 ORDER BY sum; +sum price +1 48.5 +10 48.75 +100 48.6 +200 49 +affected rows: 4 +SELECT myfunc_int(25); +myfunc_int(25) +25 +affected rows: 1 +SELECT myfunc_double(75.00); +myfunc_double(75.00) +50.00 +affected rows: 1 +"Running on the master" +DROP FUNCTION myfunc_double; +affected rows: 0 +DROP FUNCTION myfunc_int; +affected rows: 0 +SELECT * FROM mysql.func; +name ret dl type +affected rows: 0 +"Running on the slave" +SELECT * FROM mysql.func; +name ret dl type +affected rows: 0 +"Running on the master" +DROP TABLE t1; +affected rows: 0 +"*** Test 2) Test UDFs with SQL body *** +"Running on the master" +CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i; +affected rows: 0 +CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 0.95; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 0.95 +test myfuncsql_int FUNCTION i INT RETURN i +affected rows: 2 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 0.95 +test myfuncsql_int FUNCTION i INT RETURN i +affected rows: 2 +"Running on the master" +CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; +affected rows: 0 +INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00)); +affected rows: 1 +SELECT * FROM t1 ORDER BY sum; +sum price +1 475 +10 5 +100 47 +200 24 +affected rows: 4 +"Running on the slave" +SELECT * FROM t1 ORDER BY sum; +sum price +1 475 +10 5 +100 47 +200 24 +affected rows: 4 +"Running on the master" +ALTER FUNCTION myfuncsql_int COMMENT "This was altered."; +affected rows: 0 +ALTER FUNCTION myfuncsql_double COMMENT "This was altered."; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 0.95 This was altered. +test myfuncsql_int FUNCTION i INT RETURN i This was altered. +affected rows: 2 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 0.95 This was altered. +test myfuncsql_int FUNCTION i INT RETURN i This was altered. +affected rows: 2 +SELECT myfuncsql_int(25); +myfuncsql_int(25) +25 +affected rows: 1 +SELECT myfuncsql_double(75.00); +myfuncsql_double(75.00) +71 +affected rows: 1 +"Running on the master" +DROP FUNCTION myfuncsql_double; +affected rows: 0 +DROP FUNCTION myfuncsql_int; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +affected rows: 0 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +affected rows: 0 +"Running on the master" +DROP TABLE t1; +affected rows: 0 +set binlog_format=statement; +drop table if exists t1; +"*** Test 1) Test UDFs via loadable libraries *** +"Running on the master" +CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +affected rows: 0 +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +affected rows: 0 +CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +ERROR HY000: Can't find symbol 'myfunc_nonexist' in library +SELECT * FROM mysql.func; +name ret dl type +myfunc_int 2 udf_example.dll function +myfunc_double 1 udf_example.dll function +affected rows: 2 +"Running on the slave" +SELECT * FROM mysql.func; +name ret dl type +myfunc_int 2 udf_example.dll function +myfunc_double 1 udf_example.dll function +affected rows: 2 +"Running on the master" +CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; +affected rows: 0 +INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00)); +affected rows: 1 +SELECT * FROM t1 ORDER BY sum; +sum price +1 48.5 +10 48.75 +100 48.6 +200 49 +affected rows: 4 +"Running on the slave" +SELECT * FROM t1 ORDER BY sum; +sum price +1 48.5 +10 48.75 +100 48.6 +200 49 +affected rows: 4 +SELECT myfunc_int(25); +myfunc_int(25) +25 +affected rows: 1 +SELECT myfunc_double(75.00); +myfunc_double(75.00) +50.00 +affected rows: 1 +"Running on the master" +DROP FUNCTION myfunc_double; +affected rows: 0 +DROP FUNCTION myfunc_int; +affected rows: 0 +SELECT * FROM mysql.func; +name ret dl type +affected rows: 0 +"Running on the slave" +SELECT * FROM mysql.func; +name ret dl type +affected rows: 0 +"Running on the master" +DROP TABLE t1; +affected rows: 0 +"*** Test 2) Test UDFs with SQL body *** +"Running on the master" +CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i; +affected rows: 0 +CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 0.95; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 0.95 +test myfuncsql_int FUNCTION i INT RETURN i +affected rows: 2 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 0.95 +test myfuncsql_int FUNCTION i INT RETURN i +affected rows: 2 +"Running on the master" +CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; +affected rows: 0 +INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00)); +affected rows: 1 +SELECT * FROM t1 ORDER BY sum; +sum price +1 475 +10 5 +100 47 +200 24 +affected rows: 4 +"Running on the slave" +SELECT * FROM t1 ORDER BY sum; +sum price +1 475 +10 5 +100 47 +200 24 +affected rows: 4 +"Running on the master" +ALTER FUNCTION myfuncsql_int COMMENT "This was altered."; +affected rows: 0 +ALTER FUNCTION myfuncsql_double COMMENT "This was altered."; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 0.95 This was altered. +test myfuncsql_int FUNCTION i INT RETURN i This was altered. +affected rows: 2 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 0.95 This was altered. +test myfuncsql_int FUNCTION i INT RETURN i This was altered. +affected rows: 2 +SELECT myfuncsql_int(25); +myfuncsql_int(25) +25 +affected rows: 1 +SELECT myfuncsql_double(75.00); +myfuncsql_double(75.00) +71 +affected rows: 1 +"Running on the master" +DROP FUNCTION myfuncsql_double; +affected rows: 0 +DROP FUNCTION myfuncsql_int; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +affected rows: 0 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +affected rows: 0 +"Running on the master" +DROP TABLE t1; +affected rows: 0 diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index c93fbfba6e2..a8ea6ffa19f 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -220,10 +220,11 @@ event CREATE TABLE `event` ( `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, `ends` datetime DEFAULT NULL, - `status` enum('ENABLED','DISABLED') NOT NULL DEFAULT 'ENABLED', + `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `originator` int(10) NOT NULL, PRIMARY KEY (`db`,`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events' show create table general_log; -- cgit v1.2.1 From 75686dc73f0e2d5af85a9cd77fccbf2896189a42 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Mar 2007 08:17:19 -0400 Subject: WL#3629 - Replication of Invocation and Invoked Features This patch corrects errors that occurred in a local manual merge as a result of updating the local repository and includes changes necessary to correct problems found during the recalculation of next execution of events in RBR. mysql-test/include/rpl_events.inc: WL#3629 - Replication of Invocation and Invoked Features This patch changes the rpl_events test to be more comprehensive in catching errors as a result of RBR. Changes include clarification of SELECTs with WHERE clauses and synchronization with master and slave. mysql-test/r/rpl_events.result: WL#3629 - Replication of Invocation and Invoked Features This patch changes the results for the rpl_events test to accomodate the changes in the test. scripts/mysql_system_tables.sql: WL#3629 - Replication of Invocation and Invoked Features This patch adds the originator column and a new enum value to the mysql.event table. This change was necessary to accomodate changes as a result of other patches. sql/event_data_objects.cc: WL#3629 - Replication of Invocation and Invoked Features This patch corrects an error in merging that occurred during manual merge. The status check was changed to include either ENABLED or DISABLED in the gate to change the status to SLAVESIDE_DISABLED for events replicated to the slave. This patch also includes an update to correct a problem encountered during testing after the local merge. The update_timing_fields method is replicating the timing changes in RBR to the slave thereby over writing the change to the status column in the process. This code includes a check to turn off the next binlog event if in RBR. sql/event_queue.cc: WL#3629 - Replication of Invocation and Invoked Features This patch corrects an error in merging that occurred during manual merge. The code was corrected to include both types of disabled status enums (DISABLED, SLAVESIDE_DISABLED) in the create_event and update_event methods. sql/sql_show.cc: WL#3629 - Replication of Invocation and Invoked Features This patch corrects an error in merging that occurred during manual merge. It corrects the order in which the originator column appears in the show structures. The error caused incorrect output on SHOW EVENTS commands. --- mysql-test/r/rpl_events.result | 86 ++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 40 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/rpl_events.result b/mysql-test/r/rpl_events.result index 59bd16adbf6..332d8cf1c0c 100644 --- a/mysql-test/r/rpl_events.result +++ b/mysql-test/r/rpl_events.result @@ -6,7 +6,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set binlog_format=row; -DROP EVENT IF EXISTS justonce; +DROP EVENT IF EXISTS test.justonce; drop table if exists t1,t2; CREATE TABLE `t1` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, @@ -16,8 +16,11 @@ CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO t1 (c) VALUES ('manually'); -CREATE EVENT justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTo t1 +CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 (c) VALUES ('from justonce'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; +db name status originator +test justonce ENABLED 1 "in the master" SELECT * FROM t1; id c ts @@ -30,46 +33,46 @@ id c ts 1 manually TIMESTAMP 2 from justonce TIMESTAMP affected rows: 2 +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; +db name status originator +test justonce SLAVESIDE_DISABLED 1 DROP EVENT IF EXISTS test.slave_once; CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO INSERT INTO t1(c) VALUES ('from slave_once'); -SELECT db, name, status, originator FROM mysql.event; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; db name status originator -test justonce SLAVESIDE_DISABLED 1 test slave_once ENABLED 2 DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.justonce; -Warnings: -Note 1305 Event justonce does not exist CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO INSERT INTO t1(c) VALUES ('from er'); -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; -db name status originator -test er ENABLED 1 +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er') "in the slave" -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; -db name status originator -test er SLAVESIDE_DISABLED 1 +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er') "in the master" ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; -db name status originator -test er ENABLED 1 +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er') "in the slave" -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; -db name status originator -test er SLAVESIDE_DISABLED 1 +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er') "in the master" DROP EVENT test.er; -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator "in the slave" -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator "in the master" DROP TABLE t1; set binlog_format=statement; -DROP EVENT IF EXISTS justonce; +DROP EVENT IF EXISTS test.justonce; drop table if exists t1,t2; CREATE TABLE `t1` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, @@ -79,8 +82,11 @@ CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO t1 (c) VALUES ('manually'); -CREATE EVENT justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTo t1 +CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 (c) VALUES ('from justonce'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; +db name status originator +test justonce ENABLED 1 "in the master" SELECT * FROM t1; id c ts @@ -93,41 +99,41 @@ id c ts 1 manually TIMESTAMP 2 from justonce TIMESTAMP affected rows: 2 +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; +db name status originator +test justonce SLAVESIDE_DISABLED 1 DROP EVENT IF EXISTS test.slave_once; CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO INSERT INTO t1(c) VALUES ('from slave_once'); -SELECT db, name, status, originator FROM mysql.event; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; db name status originator -test justonce SLAVESIDE_DISABLED 1 test slave_once ENABLED 2 DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.justonce; -Warnings: -Note 1305 Event justonce does not exist CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO INSERT INTO t1(c) VALUES ('from er'); -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; -db name status originator -test er ENABLED 1 +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er') "in the slave" -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; -db name status originator -test er SLAVESIDE_DISABLED 1 +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er') "in the master" ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; -db name status originator -test er ENABLED 1 +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er') "in the slave" -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; -db name status originator -test er SLAVESIDE_DISABLED 1 +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er') "in the master" DROP EVENT test.er; -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator "in the slave" -SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er'; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator "in the master" DROP TABLE t1; -- cgit v1.2.1