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

Error_code: 4094; handler error HA_ERR_GENERIC and Internal MariaDB error code: 1366/1442 on tigger related binlog attempt

    XMLWordPrintable

Details

    Description

      It is suspected that binary logging may fail when a certain setup involving a trigger is used. For example;

      CREATE TABLE t1 (c INT) ENGINE=InnoDB;
      SET SESSION sql_mode='TRADITIONAL';
      CREATE TRIGGER wl1_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (CURRENT_USER());
      CREATE TEMPORARY TABLE t1 ENGINE=InnoDB AS SELECT 1;
      SET GLOBAL slave_run_triggers_for_rbr=YES;
      BINLOG ' SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
      BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA=';
      

      Leads to

      CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug)

      11.2.6-dbg>BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA=';
      ERROR 1366 (22007): Incorrect integer value: 'root@localhost' for column `test`.`t1`.`1` at row 1
      

      And in the error log we see:

      CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug)

      2024-09-14 13:38:03 4 [ERROR]  BINLOG_BASE64_EVENT: Could not execute Write_rows_v1 event on table test.t1; Incorrect integer value: 'root@localhost' for column `test`.`t1`.`1` at row 1, Error_code: 1366; At line 1 in test.wl1_trg1, Error_code: 4094; handler error HA_ERR_GENERIC; the event's master log FIRST, end_log_pos 610, Internal MariaDB error code: 1366
      

      With this testcase (same, but without the TEMPORARY table):

      CREATE TABLE t1 (c INT) ENGINE=InnoDB;
      SET SESSION sql_mode='TRADITIONAL';
      CREATE TRIGGER wl1_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (CURRENT_USER());
      SET GLOBAL slave_run_triggers_for_rbr=YES;
      BINLOG ' SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
      BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA=';
      

      We see:

      CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug)

      11.2.6-opt>BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA=';
      ERROR 1442 (HY000): Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
      

      And

      CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug)

      2024-09-14 13:44:53 4 [ERROR]  BINLOG_BASE64_EVENT: Could not execute Write_rows_v1 event on table test.t1; Can't update table 't1' 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.wl1_trg1, Error_code: 4094; handler error HA_ERR_GENERIC; the event's master log FIRST, end_log_pos 610, Internal MariaDB error code: 1442
      

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.