Bug #77095 | Incorrect binlog order for concurrent CREATE TRIGGER and DROP TRIGGER | ||
---|---|---|---|
Submitted: | 19 May 2015 13:59 | Modified: | 4 Apr 2017 10:27 |
Reporter: | Elena Stepanova | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 5.7/5.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[19 May 2015 13:59]
Elena Stepanova
[19 May 2015 16:32]
MySQL Verification Team
c:\Temp\2015may04\mysql-5.7\mysql-test>perl mysql-test-run.pl bug77095 Logging: mysql-test-run.pl bug77095 MySQL Version 5.7.8 Checking supported features... - SSL connections supported - binaries are debug compiled Collecting tests... Checking leftover processes... Removing old var directory... Creating var directory 'c:/Temp/2015may04/mysql-5.7/mysql-test/var'... Installing system database... ============================================================================== TEST RESULT TIME (ms) or COMMENT -------------------------------------------------------------------------- worker[1] Using MTR_BUILD_THREAD 301, with reserved ports 13010..13019 CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT PRIMARY KEY); CREATE TABLE t3 (a INT PRIMARY KEY); CREATE TABLE t4 (a INT PRIMARY KEY); CREATE TRIGGER trigger_1 AFTER INSERT ON t1 FOR EACH ROW UPDATE t3 SET a=a+1; SET SESSION debug="+d,inject_drop_trigger_sleep_before_binlog"; DROP TRIGGER trigger_1; CREATE TRIGGER trigger_1 AFTER INSERT ON t2 FOR EACH ROW UPDATE t4 SET a=a+1; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 4 Format_desc 1 123 Server ver: 5.7.8-rc-debug-log, Binlog ver: 4 master-bin.000001 123 Previous_gtids 1 154 master-bin.000001 154 Anonymous_Gtid 1 219 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' master-bin.000001 219 Query 1 328 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) master-bin.000001 328 Anonymous_Gtid 1 393 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' master-bin.000001 393 Query 1 502 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) master-bin.000001 502 Anonymous_Gtid 1 567 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' master-bin.000001 567 Query 1 676 use `test`; CREATE TABLE t3 (a INT PRIMARY KEY) master-bin.000001 676 Anonymous_Gtid 1 741 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' master-bin.000001 741 Query 1 850 use `test`; CREATE TABLE t4 (a INT PRIMARY KEY) master-bin.000001 850 Anonymous_Gtid 1 915 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' master-bin.000001 915 Query 1 1112 use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER trigger_1 AFTER INSERT ON t1 FOR EACH ROW UPDATE t3 SET a=a+1 master-bin.000001 1112 Anonymous_Gtid 1 1177 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' master-bin.000001 1177 Query 1 1374 use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER trigger_1 AFTER INSERT ON t2 FOR EACH ROW UPDATE t4 SET a=a+1 master-bin.000001 1374 Anonymous_Gtid 1 1439 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' master-bin.000001 1439 Query 1 1535 use `test`; DROP TRIGGER trigger_1 DROP TRIGGER trigger_1; DROP TABLE t1,t2,t3,t4; main.bug77095 [ pass ] 28966 -------------------------------------------------------------------------- The servers were restarted 0 times Spent 28.966 of 182 seconds executing testcases
[19 May 2015 16:39]
MySQL Verification Team
Checking leftover processes... Removing old var directory... Creating var directory 'c:/Temp/2015may04/mysql-5.6/mysql-test/var'... Installing system database... ============================================================================== TEST RESULT TIME (ms) or COMMENT -------------------------------------------------------------------------- worker[1] Using MTR_BUILD_THREAD 301, with reserved ports 13010..13019 CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT PRIMARY KEY); CREATE TABLE t3 (a INT PRIMARY KEY); CREATE TABLE t4 (a INT PRIMARY KEY); CREATE TRIGGER trigger_1 AFTER INSERT ON t1 FOR EACH ROW UPDATE t3 SET a=a+1; SET SESSION debug="+d,inject_drop_trigger_sleep_before_binlog"; DROP TRIGGER trigger_1; CREATE TRIGGER trigger_1 AFTER INSERT ON t2 FOR EACH ROW UPDATE t4 SET a=a+1; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 4 Format_desc 1 120 Server ver: 5.6.26-debug-log, Binlog ver: 4 master-bin.000001 120 Query 1 229 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) master-bin.000001 229 Query 1 338 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) master-bin.000001 338 Query 1 447 use `test`; CREATE TABLE t3 (a INT PRIMARY KEY) master-bin.000001 447 Query 1 556 use `test`; CREATE TABLE t4 (a INT PRIMARY KEY) master-bin.000001 556 Query 1 749 use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER trigger_1 AFTER INSERT ON t1 FOR EACH ROW UPDATE t3 SET a=a+1 master-bin.000001 749 Query 1 942 use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER trigger_1 AFTER INSERT ON t2 FOR EACH ROW UPDATE t4 SET a=a+1 master-bin.000001 942 Query 1 1038 use `test`; DROP TRIGGER trigger_1 DROP TRIGGER trigger_1; DROP TABLE t1,t2,t3,t4;
[19 May 2015 16:53]
MySQL Verification Team
Thank you for the bug report.
[19 Oct 2016 6:33]
Dmitry Shulga
Posted by developer: After WL#7896 was pushed into trunk this bug is no more possible since the worklog added acquiring of EXCLUSIVE MDL for trigger name while handling CREATE/DROP TRIGGER, DROP DATABASE, DROP TABLE, ALTER TABLE, RENAME TABLE.
[4 Apr 2017 10:27]
Erlend Dahl
[31 Mar 2017 9:10] David Moss Thank you for your feedback, this has been fixed in upcoming versions and the following was added to the 8.0.1 changelog: Concurrent CREATE TRIGGER and DROP TRIGGER statements were not being binary logged in the correct order, causing slaves to fail.