mirror of
https://github.com/MariaDB/server.git
synced 2025-06-06 05:21:19 +03:00
Bug #51391 Deadlock involving events during rqg_info_schema test
This was a deadlock between CREATE/ALTER/DROP EVENT and a query accessing both the mysql.event table and I_S.GLOBAL_VARIABLES. The root of the problem was that the LOCK_event_metadata mutex was used to both protect the "event_scheduler" global system variable and the internal event data structures used by CREATE/ALTER/DROP EVENT. The deadlock would occur if CREATE/ALTER/DROP EVENT held LOCK_event_metadata while trying to open the mysql.event table, at the same time as the query had mysql.event open, trying to lock LOCK_event_metadata to access "event_scheduler". This bug was fixed in the scope of Bug#51160 by using only LOCK_global_system_variables to protect "event_scheduler". This makes it so that the query above won't lock LOCK_event_metadata, thereby preventing this deadlock from occuring. This patch contains no code changes. Test case added to lock_sync.test.
This commit is contained in:
parent
48ac4ff51f
commit
4347e302a8
@ -92,3 +92,23 @@ COMMIT;
|
|||||||
# Connection default
|
# Connection default
|
||||||
# Reaping ALTER TABLE t1 ADD COLUMN j INT
|
# Reaping ALTER TABLE t1 ADD COLUMN j INT
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
#
|
||||||
|
# Bug#51391 Deadlock involving events during rqg_info_schema test
|
||||||
|
#
|
||||||
|
CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
|
||||||
|
CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
|
||||||
|
# Connection con1
|
||||||
|
SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
|
||||||
|
# Sending:
|
||||||
|
DROP EVENT e1;;
|
||||||
|
# Connection default
|
||||||
|
SET DEBUG_SYNC="now WAIT_FOR drop";
|
||||||
|
SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE definer = VARIABLE_VALUE;
|
||||||
|
name
|
||||||
|
SET DEBUG_SYNC="now SIGNAL query";
|
||||||
|
# Connection con1
|
||||||
|
# Reaping: DROP EVENT t1
|
||||||
|
# Connection default
|
||||||
|
DROP EVENT e2;
|
||||||
|
SET DEBUG_SYNC="RESET";
|
||||||
|
@ -178,6 +178,39 @@ DROP TABLE t1, t2;
|
|||||||
disconnect con2;
|
disconnect con2;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#51391 Deadlock involving events during rqg_info_schema test
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
|
||||||
|
CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
|
||||||
|
|
||||||
|
--echo # Connection con1
|
||||||
|
connect(con1, localhost, root);
|
||||||
|
SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
|
||||||
|
--echo # Sending:
|
||||||
|
--send DROP EVENT e1;
|
||||||
|
|
||||||
|
--echo # Connection default
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC="now WAIT_FOR drop";
|
||||||
|
SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE definer = VARIABLE_VALUE;
|
||||||
|
SET DEBUG_SYNC="now SIGNAL query";
|
||||||
|
|
||||||
|
--echo # Connection con1
|
||||||
|
connection con1;
|
||||||
|
--echo # Reaping: DROP EVENT t1
|
||||||
|
--reap
|
||||||
|
disconnect con1;
|
||||||
|
--source include/wait_until_disconnected.inc
|
||||||
|
|
||||||
|
--echo # Connection default
|
||||||
|
connection default;
|
||||||
|
DROP EVENT e2;
|
||||||
|
SET DEBUG_SYNC="RESET";
|
||||||
|
|
||||||
|
|
||||||
# Check that all connections opened by test cases in this file are really
|
# Check that all connections opened by test cases in this file are really
|
||||||
# gone so execution of other tests won't be affected by their presence.
|
# gone so execution of other tests won't be affected by their presence.
|
||||||
--source include/wait_until_count_sessions.inc
|
--source include/wait_until_count_sessions.inc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user