Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10924

CREATE OR REPLACE TRIGGER which fails on PRECEDES/FOLLOWS drops the trigger, but isn't written to binlog; replication fails

Details

    Description

      --source include/master-slave.inc
      --source include/have_binlog_format_mixed.inc
       
      CREATE TABLE t1 (i INT);
       
      CREATE OR REPLACE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET @a=1;
      --error ER_REFERENCED_TRG_DOES_NOT_EXIST
      CREATE OR REPLACE TRIGGER tr BEFORE DELETE ON t1 FOR EACH ROW PRECEDES non_existing_trigger SET @a=2;
      SHOW TRIGGERS;
       
      --sync_slave_with_master
      SHOW TRIGGERS;
      

      Result of this test case is that master and slave go out of sync: master has no triggers, but slave still has tr.
      That's because when CREATE OR REPLACE TRIGGER, it still drops the trigger, but nothing is written to the binary log.

      It's possible that the underlying problem exists in earlier versions, but I couldn't reproduce it with a few other errors which can happen on trigger re-creation.

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value

            Fixed by first testing if anchor trigger exists before deleting any trigger files

            monty Michael Widenius added a comment - Fixed by first testing if anchor trigger exists before deleting any trigger files
            monty Michael Widenius made changes -
            Fix Version/s N/A [ 14700 ]
            Fix Version/s 10.2 [ 14601 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 77615 ] MariaDB v4 [ 150985 ]

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.