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

Standalone XA COMMIT Binlogged on Replica if its Body Hits a Skipped Error

    XMLWordPrintable

Details

    Description

      When replicating an XA transaction, if the body of the transaction (XA START through XA PREPARE) runs into an error, but that error is in skip-slave-errors, it won't be be binlogged. The corresponding XA COMMIT, however, will be binlogged without error, leading to an invalid binary log. The following MTR test snippet highlights this:

      config file: rpl_bug.cnf

      !include ../my.cnf
       
      [mysqld.2]
      slave-skip-errors=1032
      innodb
      log-slave-updates
       
      [mysqld.3]
      innodb
       
      [ENV]
      SERVER_MYPORT_1= @mysqld.1.port
      SERVER_MYPORT_2= @mysqld.2.port
      SERVER_MYPORT_3= @mysqld.3.port
      

      mtr file: rpl_bug.test

      --source include/have_innodb.inc
      --source include/have_binlog_format_row.inc
      --let $rpl_server_count= 3
      --let $rpl_topology= 1->2->3
      --source include/rpl_init.inc
       
      --echo #
      --echo # Initialize test data
      --connection server_1
      create table t1 (a int) engine=innodb;
      insert into t1 values (1);
      insert into t1 values (2);
      --source include/save_master_gtid.inc
       
      --connection server_2
      --source include/sync_with_master_gtid.inc
       
      --connection server_2
      set statement SQL_LOG_BIN=0 FOR delete from t1 where a=1;
       
      --connection server_1
      xa start '1';
      update t1 set a=3 where a=1;
      xa end '1';
      xa prepare '1';
      xa commit '1';
      --source include/save_master_gtid.inc
       
      --connection server_3
      --let $slave_sql_errno=1397
      --source include/wait_for_slave_sql_error.inc
      --die Hit Error 'XAER_NOTA: Unknown XID' on query
       
      --echo #
      --echo # Cleanup
      --connection server_1
      DROP TABLE t1;
      --source include/save_master_gtid.inc
       
      --connection server_2
      --source include/sync_with_master_gtid.inc
       
      --source include/rpl_end.inc
       
      --echo # End of tests
      

      Attachments

        Issue Links

          Activity

            People

              bnestere Brandon Nesterenko
              bnestere Brandon Nesterenko
              Votes:
              1 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.