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

Slave halts upon DELETE trigger leading to errors 1442 and 4094

    XMLWordPrintable

Details

    Description

      --source include/have_binlog_format_row.inc
      --source include/master-slave.inc
      --connection slave
      STOP SLAVE;
      SET GLOBAL slave_run_triggers_for_rbr=LOGGING;
      START SLAVE;
      --connection master
      CREATE TABLE t1 (c INT);
      CREATE TABLE t2 (c INT);
      INSERT INTO t1 VALUES(1);
      INSERT INTO t2 VALUES(0);
      CREATE TRIGGER tr1 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t2;
      DELETE FROM t1;
      --sync_slave_with_master
      DROP TABLE t1,t2;
      --source include/rpl_end.inc
      

      Leads to:

      11.5.0 eeba940311ed17d160023280783fd2bbb64abef3 (Debug)

      Slave_SQL_Running	No
      ...
      Last_Errno	1442
      Last_Error	Could not execute Delete_rows_v1 event on table test.t1; Can't update table 't2' in stored function/trigger because it is already used by statement which invoked this stored function/trigger, Error_code: 1442; At line 1 in test.tr1, Error_code: 4094; handler error HA_ERR_GENERIC; the event's master log master-bin.000001, end_log_pos 0
      

      The error is not correct as t2 is not being used by the DELETE statement as mentioned in the error.
      Note also that the master has no issue with executing the statements, only the slave fails.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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