[MDEV-24395] Atomic DROP TRIGGER Created: 2020-12-11  Updated: 2022-11-01  Resolved: 2021-05-20

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Procedure, Triggers
Fix Version/s: 10.6.1

Type: Task Priority: Critical
Reporter: Michael Widenius Assignee: Michael Widenius
Resolution: Fixed Votes: 1
Labels: None

Issue Links:
PartOf
is part of MDEV-17567 Atomic DDL Closed

 Description   

The purpose of this task is to ensure that DROP TRIGGER is atomic.

Description of how atomic drop trigger should work:

Logging of DROP TRIGGER

  • Log to ddl log:
  • db
  • table name
  • trigger name
  • xid /* Used to check if query was already logged to binary log */
  • initial length of the .TRG file
  • query if there is space for it, if not log a zero length query.

Recovery operations:

  • Delete if exists 'database/trigger_name.TRN~'
    If this file existed, it means that we crashed before the trigger
    was deleted and there is nothing else to do.
  • Get length of TRG file
  • If file length is unchanged, trigger was not dropped. Nothing else to do.
  • Log original query to binary, if it was stored in the ddl log. If it was not stored (long query
    string), log the following query to binary log:
    use `database` ; DROP TRIGGER IF EXISTS `trigger_name` /* generated by ddl log */

Generated at Thu Feb 08 09:29:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.