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

Replication fails when dropping multiple tables with foreign key constraints multiple times

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6.7
    • None
    • Server
    • None

    Description

      Dropping multiple tables that have foreign key constraints due to which one or some of the tables cannot be dropped and repeating dropping the same tables again will lead to a replication failure. On both primary and replica all tables will be dropped, but the replication stops with an error.

      How to reproduce:

      mysql (foobar)> create table a (id int primary key);
      Query OK, 0 rows affected (0.013 sec)
       
      mysql (foobar)> create table b (id int primary key, ref int, constraint `tablea` foreign key (ref) references a (id));
      Query OK, 0 rows affected (0.011 sec)
       
      mysql (foobar)> insert into a values (2);
      Query OK, 1 row affected (0.003 sec)
       
      mysql (foobar)> insert into b values (1, 2);
      Query OK, 1 row affected (0.003 sec)
       
      mysql (foobar)> drop table a, b;
      ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails
      mysql (foobar)> show tables;
      +------------------+
      | Tables_in_foobar |
      +------------------+
      | a                |
      +------------------+
      1 row in set (0.002 sec)
       
      mysql (foobar)> drop table a, b;
      ERROR 1051 (42S02): Unknown table 'foobar.b'
      mysql (foobar)> show tables;
      Empty set (0.000 sec)
      

      The second drop table command causes the replication to stop.

      Cheers
      Volker

      Attachments

        Activity

          People

            Unassigned Unassigned
            vklasen Volker Klasen
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.