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

GTID strict mode does not allow slave to continue replicating after crash which happened during writing event group

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • None
    • 10.0.7
    • None
    • None

    Description

      If a slave crashes while writing an event group into its binary log, specifically after writing GTID event but before finishing Xid, and if gtid_strict_mode is enabled, the slave cannot resume replication after restart, it aborts with the error "An attempt was made to binlog GTID X-Y-Z which would create an out-of-order sequence number with existing GTID X-Y-Z, and gtid strict mode is enabled".

      Note: This is a follow-up on the failure that we discussed earlier on IRC. I can now positively confirm that the failure I observed also happened upon slave crash. And as you suggested, I was able to reproduce it with "crash_before_writing_xid" (see the test case below). In fact, in my case the picture was slightly different, the slave crashed one step earlier, right after writing the GTID event, and before writing anything else. I tried to add a debug crash point there and it causes the same problem, so I suppose crash_before_writing_xid will do just as well.

      Test case:

      --source include/master-slave.inc
      --source include/have_innodb.inc
       
      create table t1 (i int) engine=InnoDB;
      insert into t1 values (1),(2);
       
      --sync_slave_with_master
       
      --source include/stop_slave.inc
      set sql_log_bin = 0;
      alter table mysql.gtid_slave_pos engine=InnoDB;
      change master to master_use_gtid=current_pos;
      --source include/start_slave.inc
       
      --let $_server_id= `SELECT @@server_id`
      --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
      --write_file $_expect_file_name
      wait
      EOF
       
      SET GLOBAL debug_dbug="+d,crash_before_writing_xid";
       
      connection master;
       
      insert into t1 values (3),(4);
       
      connection slave;
       
      --source include/wait_until_disconnected.inc
       
      --append_file $_expect_file_name
      restart: --gtid_strict_mode=1
      EOF
       
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      show variables like 'gtid%';
       
      # I intentionally don't use the include file here, 
      # because start_slave.inc is indeterministic when a problem occurs on startup.
      # If something goes wrong, the next sync_slave_with_master will indicate that
       
      start slave;
       
      connection master;
      drop table t1;
       
      --sync_slave_with_master
      query_vertical show slave status;

      bzr version-info

      revision-id: sergii@pisem.net-20130624185655-3ysky07m0gvet6gl
      revno: 3669
      branch-nick: 10.0-base

      Attachments

        Issue Links

          Activity

            People

              knielsen Kristian Nielsen
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.