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

Replication aborts after DDL under FOREIGN_KEY_CHECKS=OFF

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1
    • 10.5, 10.6, 10.11, 11.1
    • Replication
    • None

    Description

      I am setting it to minor, because setting foreign_key_checks=off rarely ends well with or without replication. However, since the value is stored in the binlog, it could be expected that it works the same way on the master and slave (even if it's not a good way).

      --source include/have_innodb.inc
      --source include/master-slave.inc
       
      CREATE TABLE t1 (id INT, KEY(id)) ENGINE=InnoDB;
      CREATE TABLE t2 (id INT) ENGINE=InnoDB;
      SET foreign_key_checks = OFF;
      ALTER TABLE t2 ADD FOREIGN KEY (id) REFERENCES t1 (id);
      ALTER TABLE t1 MODIFY id BIGINT;
      SET foreign_key_checks = ON;
      --error ER_ERROR_ON_RENAME
      ALTER TABLE t2 FORCE, ALGORITHM=COPY;
      ALTER TABLE t2 MODIFY id BIGINT;
       
      --sync_slave_with_master
       
      # Cleanup
      --connection master
      DROP TABLE t2, t1;
      --source include/rpl_end.inc
      

      10.5 1a5c4c2d

      Last_Error	Error 'Cannot change column 'id': used in a foreign key constraint 't2_ibfk_1'' on query. Default database: 'test'. Query: 'ALTER TABLE t2 MODIFY id BIGINT'
      

      Reproducible on 10.5+.
      The test case is not applicable to 10.4, it behaves differently under foreign_key_checks=off.

      Attachments

        Activity

          People

            Elkin Andrei Elkin
            elenst Elena Stepanova
            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.