summaryrefslogtreecommitdiff
path: root/mysql-test/r/show_check.result
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2010-07-23 10:44:55 +0200
committerJon Olav Hauglid <jon.hauglid@oracle.com>2010-07-23 10:44:55 +0200
commit54c5e7c88f322b6fe1afc643d448d4e8c6edd113 (patch)
tree55020f807bf6610c2c8bfbf0637f54e11faeff0f /mysql-test/r/show_check.result
parent5f9de42e26f9a97eca87227ea5315ea7d20c51c3 (diff)
downloadmariadb-git-54c5e7c88f322b6fe1afc643d448d4e8c6edd113.tar.gz
Bug #55498 SHOW CREATE TRIGGER takes wrong type of metadata lock
The first problem was that SHOW CREATE TRIGGER took a stronger metadata lock than required. This caused the statement to be blocked when it was not needed. For example, LOCK TABLE WRITE in one connection would block SHOW CREATE TRIGGER in another connection. Another problem was that a SHOW CREATE TRIGGER statement issued inside a transaction did not release its metadata locks at the end of the statement execution. This happened even if SHOW CREATE TRIGGER is an information statement. The consequence was that SHOW CREATE TRIGGER was able to block other connections from accessing the table (e.g. using ALTER TABLE). This patch fixes the problem by changing SHOW CREATE TRIGGER to take a MDL_SHARED_HIGH_PRIO metadata lock similar to what is already done for SHOW CREATE TABLE. The patch also changes SHOW CREATE TRIGGER to explicitly release any metadata locks taken by the statement after it completes. Test case added to show_check.test.
Diffstat (limited to 'mysql-test/r/show_check.result')
-rw-r--r--mysql-test/r/show_check.result27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index f49366cbf08..c1a75281e0e 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1487,3 +1487,30 @@ UNLOCK TABLES;
# Connection default
COMMIT;
DROP TABLE t1;
+#
+# Bug#55498 SHOW CREATE TRIGGER takes wrong type of metadata lock.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1;
+# Test 1: SHOW CREATE TRIGGER with WRITE locked table.
+# Connection con1
+LOCK TABLE t1 WRITE;
+# Connection default
+SHOW CREATE TRIGGER t1_bi;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
+# Connection con1
+UNLOCK TABLES;
+# Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction
+# Connection default
+START TRANSACTION;
+SHOW CREATE TRIGGER t1_bi;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
+# Connection con1
+ALTER TABLE t1 CHARACTER SET = utf8;
+# Connection default
+COMMIT;
+DROP TRIGGER t1_bi;
+DROP TABLE t1;