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

Replica halts with Internal MariaDB error code: 1452 and HA_ERR_NO_REFERENCED_ROW on FK constraint

    XMLWordPrintable

Details

    Description

      This looks like a major failure in replication. Please review and adjust prio as needed.

      # Requires standard m/s setup. Tested with both ROW and MIXED.
      SET sql_mode='',enforce_storage_engine=MyISAM;
      CREATE TABLE t (c1 INT PRIMARY KEY, c2 INT, FOREIGN KEY(c2) REFERENCES t (c1)) ENGINE=foo;
      SHOW WARNINGS;
      SHOW CREATE TABLE t;
      INSERT INTO t VALUES (1,2);
      

      Leads to:

      11.4.0 8bf9f21855606ddeb0fe90fb1e70165adbec6746 (Optimized)

      2024-02-03 16:42:57 6 [ERROR] Slave SQL: Could not execute Write_rows_v1 event on table test.t; Cannot add or update a child row: a foreign key constraint fails (`test`.`t`, CONSTRAINT `t_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t` (`c1`)), Error_code: 1452; handler error HA_ERR_NO_REFERENCED_ROW; the event's master log binlog.000001, end_log_pos 0, Gtid 0-1-5, Internal MariaDB error code: 1452
      2024-02-03 16:42:57 6 [Warning] Slave: Cannot add or update a child row: a foreign key constraint fails (`test`.`t`, CONSTRAINT `t_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t` (`c1`)) Error_code: 1452
      2024-02-03 16:42:57 6 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'binlog.000001' position 1166; GTID position '0-1-4'
      2024-02-03 16:42:57 6 [Note] Slave SQL thread exiting, replication stopped in log 'binlog.000001' at position 1166; GTID position '0-1-4', master: 127.0.0.1:10177
      

      11.4.0 8bf9f21855606ddeb0fe90fb1e70165adbec6746 (Debug)

      2024-02-03 16:37:18 6 [ERROR] Slave SQL: Error 'Cannot add or update a child row: a foreign key constraint fails (`test`.`t`, CONSTRAINT `t_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t` (`c1`))' on query. Default database: 'test'. Query: 'INSERT INTO t VALUES (1,2)', Gtid 0-1-5, Internal MariaDB error code: 1452
      2024-02-03 16:37:18 6 [Warning] Slave: Cannot add or update a child row: a foreign key constraint fails (`test`.`t`, CONSTRAINT `t_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t` (`c1`)) Error_code: 1452
      2024-02-03 16:37:18 6 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'binlog.000001' position 1075; GTID position '0-1-4'
      

      Attachments

        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.