mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
f32c08bd0c
If an EVENT is created without the DEFINER clause set explicitly or with it set to CURRENT_USER, the master and slaves become inconsistent. This issue stems from the fact that in both cases, the DEFINER is set to the CURRENT_USER of the current thread. On the master, the CURRENT_USER is the mysqld's user, while on the slave, the CURRENT_USER is empty for the SQL Thread which is responsible for executing the statement. To fix the problem, we do what follows. If the definer is not set explicitly, a DEFINER clause is added when writing the query into binlog; if 'CURRENT_USER' is used as the DEFINER, it is replaced with the value of the current user before writing to binlog. mysql-test/suite/rpl/r/rpl_create_if_not_exists.result: Updated the result file after fixing bug#44331 mysql-test/suite/rpl/r/rpl_drop_if_exists.result: Updated the result file after fixing bug#44331 mysql-test/suite/rpl/r/rpl_events.result: Test result of Bug#44331 mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result: Updated the result file after fixing bug#44331 mysql-test/suite/rpl/t/rpl_events.test: Added test to verify 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 sql/events.cc: The "create_query_string" function is added to create a new query string for removing executable comments. sql/sql_yacc.yy: The remember_name token was added for recording the offset of EVENT_SYM.
98 lines
5.3 KiB
Text
98 lines
5.3 KiB
Text
RESET MASTER;
|
|
DROP PROCEDURE IF EXISTS db_bug_13684.p;
|
|
DROP FUNCTION IF EXISTS db_bug_13684.f;
|
|
DROP TRIGGER IF EXISTS db_bug_13684.tr;
|
|
DROP VIEW IF EXISTS db_bug_13684.v;
|
|
DROP EVENT IF EXISTS db_bug_13684.e;
|
|
DROP TABLE IF EXISTS db_bug_13684.t;
|
|
DROP DATABASE IF EXISTS db_bug_13684;
|
|
show binlog events from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p
|
|
master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
|
|
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
|
|
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
|
|
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
|
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
|
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
|
CREATE DATABASE db_bug_13684;
|
|
CREATE TABLE db_bug_13684.t (a int);
|
|
CREATE EVENT db_bug_13684.e
|
|
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
|
DO
|
|
UPDATE db_bug_13684.t SET a = a + 1;
|
|
CREATE VIEW db_bug_13684.v
|
|
AS SELECT * FROM db_bug_13684.t;
|
|
CREATE TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t
|
|
FOR EACH ROW BEGIN
|
|
END;
|
|
CREATE PROCEDURE db_bug_13684.p (OUT p1 INT)
|
|
BEGIN
|
|
END;
|
|
CREATE FUNCTION db_bug_13684.f (s CHAR(20))
|
|
RETURNS CHAR(50) DETERMINISTIC
|
|
RETURN s;
|
|
show binlog events from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p
|
|
master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
|
|
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
|
|
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
|
|
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
|
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
|
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
|
master-bin.000001 # Query # # CREATE DATABASE db_bug_13684
|
|
master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int)
|
|
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e
|
|
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
|
DO
|
|
UPDATE db_bug_13684.t SET a = a + 1
|
|
master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db_bug_13684`.`v` AS SELECT * FROM db_bug_13684.t
|
|
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t
|
|
FOR EACH ROW BEGIN
|
|
END
|
|
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `db_bug_13684`.`p`(OUT p1 INT)
|
|
BEGIN
|
|
END
|
|
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_bug_13684`.`f`(s CHAR(20)) RETURNS char(50) CHARSET latin1
|
|
DETERMINISTIC
|
|
RETURN s
|
|
DROP PROCEDURE IF EXISTS db_bug_13684.p;
|
|
DROP FUNCTION IF EXISTS db_bug_13684.f;
|
|
DROP TRIGGER IF EXISTS db_bug_13684.tr;
|
|
DROP VIEW IF EXISTS db_bug_13684.v;
|
|
DROP EVENT IF EXISTS db_bug_13684.e;
|
|
DROP TABLE IF EXISTS db_bug_13684.t;
|
|
DROP DATABASE IF EXISTS db_bug_13684;
|
|
show binlog events from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p
|
|
master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
|
|
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
|
|
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
|
|
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
|
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
|
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
|
master-bin.000001 # Query # # CREATE DATABASE db_bug_13684
|
|
master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int)
|
|
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e
|
|
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
|
DO
|
|
UPDATE db_bug_13684.t SET a = a + 1
|
|
master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db_bug_13684`.`v` AS SELECT * FROM db_bug_13684.t
|
|
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t
|
|
FOR EACH ROW BEGIN
|
|
END
|
|
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `db_bug_13684`.`p`(OUT p1 INT)
|
|
BEGIN
|
|
END
|
|
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_bug_13684`.`f`(s CHAR(20)) RETURNS char(50) CHARSET latin1
|
|
DETERMINISTIC
|
|
RETURN s
|
|
master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p
|
|
master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
|
|
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
|
|
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
|
|
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
|
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
|
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|