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

DDL Algorithm <> Copy could break row based replication

    XMLWordPrintable

Details

    Description

      Problem found during RQG testing involving row based replication.

      ./mysql-test-run.pl --mem  rpl_t_s_4 | tee prt
      ...
      main.rpl_t_s_4 'innodb,mix'              [ skipped ]  Not ROW format
      include/master-slave.inc
      [connection master]
      CREATE TABLE t1 (col1 INT, col2 INT, col_c CHAR(20), KEY idx2 (col_c)) ENGINE = InnoDB ;
      INSERT INTO t1 (col1, col2, col_c) VALUES ( 1 , 1, '1');
      INSERT INTO t1 (col1, col2, col_c) VALUES ( 2 , 2, '2');
      INSERT INTO t1 (col1, col2, col_c) VALUES ( 3 , 3, '3');
      INSERT INTO t1 (col1, col2, col_c) VALUES ( 4 , 4, '3333333333');
      INSERT INTO t1 (col1, col2, col_c) VALUES ( 5 , 5, '3333333333');
      UPDATE t1 SET col2 = 453 WHERE col1 IN (5,4);
      UPDATE t1 SET col2 = 130 WHERE col1 IN (5,4);
      UPDATE t1 SET col2 = 99 WHERE col1 IN (5,4);
      UPDATE t1 SET col2 = 202 WHERE col1 IN (5,4);
      UPDATE t1 SET col2 = 464 WHERE col1 IN (5,4);
      UPDATE t1 SET col2 = 430 WHERE col1 IN (5,4);
      INSERT INTO t1 (col1, col2, col_c) VALUES ( 6 , 6, '6');
      ALTER TABLE t1 ADD UNIQUE KEY uidx2 ( col1, col_c );
      UPDATE t1 SET col2 = 213 WHERE col1 = 5;
      main.rpl_t_s_4 'innodb,row'              [ fail ]
      ...
      === SHOW SLAVE STATUS ===
      ...
      Slave_IO_Running        Yes
      Slave_SQL_Running       No
      ...
      Last_Errno      1062
      Last_Error      Could not execute Update_rows_v1 event on table test.t1; Duplicate entry '5-3333333333' for key 'uidx2', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 4228
       
      Given the fact that using
         ALTER TABLE t1 ADD UNIQUE KEY uidx2 ( col1, col_c ), ALGORITHM = COPY;
         or
         Engine = MyISAM instead of InnoDB
      makes the problem disappear I guess its more an InnoDB than a replication bug.
       
      10.3 09bd2138522787a4e0b015695c462903f4a9e728 2019-02-22
      10.4 5b4d6595d26aaaf0bf8bb3c9171cf1da96306a7c 2019-02-21
      

      Attachments

        1. rpl_t_s_4.test
          2 kB
        2. prt
          25 kB

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              mleich Matthias Leich
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.