Bug #101809 | "DROP TRIGGER IF EXISTS” in concurrent sessions leads to an error | ||
---|---|---|---|
Submitted: | 1 Dec 2020 2:11 | Modified: | 8 Dec 2020 15:38 |
Reporter: | Akshay Suryawanshi (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 5.7, 5.7.32 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | Contribution, Drop, IF EXISTS, trigger |
[1 Dec 2020 2:11]
Akshay Suryawanshi
[1 Dec 2020 2:12]
Akshay Suryawanshi
Patch for this bug request (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: 0001-Drop-trigger-if-exists-error-fix.patch (application/octet-stream, text), 1.31 KiB.
[1 Dec 2020 8:07]
MySQL Verification Team
Hello Akshay, Thank you for the report and contribution. Verified as described with 5.7.32 build. regards, Umesh
[7 Dec 2020 10:40]
Dmitry Lenev
Posted by developer: Hello! The problem is not repeatable in 8.0 branch of server because it was fixed as part of New Data Dictionary work by introducing proper locking on trigger names. This was done by the following patch: commit 7d09dd19cc8119d42862bfe7a7e0b5f17735cdce Author: Dmitry Shulga <dmitry.shulga@oracle.com> Date: Tue Aug 9 21:37:52 2016 +0600 This is implementation of WL#7896 - Use DD API to work with triggers. Within this WL the following changes were made: * the statements CREATE/DROP TRIGGER use the new dd api to store/retrieve triggers metadata from the data dictionary; ... * added support for MDL locking while handling CREATE/DROP TRIGGER; To support it the new standalone function acquire_mdl_for_trigger was added that is called right after the method open_and_lock_subj_table returns success. Also this function called indirectly (over call of the new function lock_trigger_names) as part of dropping a table; ... which was pushed to 8.0.1 Development Milestone Release. While the contributed patch for 5.7 alleviates the problem in the specific case mentioned in bug report it still doesn't fully fix broader class of similar scenarios. For example, proper fix should ensure that we have correct order of events in binary log which requires some form of locking for trigger names. Taking into account the above we choose not to apply the contributed patch to 5.7 branch and close the bug as fixed in 8.0.1.
[8 Dec 2020 15:38]
Paul DuBois
Posted by developer: Fixed in 8.0.1 by the switch to the Data Dictionary.