mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #44331 Restore of database with events produces warning in replication
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.
This commit is contained in:
@ -690,7 +690,7 @@ test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat
|
||||
USE test_rpl;
|
||||
SHOW EVENTS;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
test_rpl e1 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
==========MASTER==========
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
@ -1078,7 +1078,7 @@ master-bin.000001 # Query 1 # use `test_rpl`; GRANT EVENT ON *.* TO 'root'@'loca
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; CREATE DEFINER=`root`@`localhost` EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; ALTER EVENT e1 RENAME TO e2
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; DROP EVENT e2
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
|
Reference in New Issue
Block a user