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

Infinite IO error and reconnect when slave has MASTER_USE_GTID=NO on a binlog-in-engine master

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • Hide
      When a slave configured with MASTER_USE_GTID=NO connected to a master running with --binlog-storage-engine enabled, the slave IO thread looped infinitely, reconnecting repeatedly without reporting an error in SHOW SLAVE STATUS (where Last_IO_Errno remained 0 and Slave_IO_Running stayed as Preparing or Connecting). The master now returns fatal error 1236, which causes the slave IO thread to stop and report the error. To replicate successfully, configure the slave to use GTID (for example, by setting MASTER_USE_GTID=slave_pos).
      Show
      When a slave configured with MASTER_USE_GTID=NO connected to a master running with --binlog-storage-engine enabled, the slave IO thread looped infinitely, reconnecting repeatedly without reporting an error in SHOW SLAVE STATUS (where Last_IO_Errno remained 0 and Slave_IO_Running stayed as Preparing or Connecting). The master now returns fatal error 1236, which causes the slave IO thread to stop and report the error. To replicate successfully, configure the slave to use GTID (for example, by setting MASTER_USE_GTID=slave_pos).
    • Q4/2026 Replic. Development

    Description

      A binlog-in-engine (BiE) master serves dump requests only from a GTID position. A slave configured with MASTER_USE_GTID=NO is accepted without any error, but its IO thread can never connect. The requirement is documented, but the server doesn't report it anywhere a user would look.

      Steps to reproduce
      1. Start a master with --log-bin --binlog-storage-engine=innodb and a slave replicating from it.
      2. On the slave, run:
      CHANGE MASTER TO MASTER_USE_GTID=NO, MASTER_LOG_FILE='binlog-000000.ibb', MASTER_LOG_POS=4;
      START SLAVE;
      3. Insert rows on the master.
      4. Run SHOW SLAVE STATUS on the slave.

      Actual result

      • CHANGE MASTER and START SLAVE both succeed, with no error or warning.
      • Slave_IO_Running stays at Preparing or Connecting. Last_IO_Errno is 0 and Last_IO_Error is empty.
      • Nothing replicates.
      • The slave error log repeats Error reading packet from server: GTID starting position is required on master with --binlog-storage-engine enabled (server_errno=4246).

      # A BiE master can only serve a dump request that starts from a GTID position
      # ("GTID starting position is required on master with --binlog-storage-engine
      # enabled"). The plan expects a clear error at CHANGE MASTER or START SLAVE.
      #
      # This test records what actually happens today:
      #   - CHANGE MASTER and START SLAVE both succeed silently
      #   - the IO thread never connects, and keeps retrying with no backoff
      #   - SHOW SLAVE STATUS shows no error (Last_IO_Errno = 0)
      #   - nothing replicates
      # Lines marked "BUG" below are the ones that should change when the server
      # reports the GTID requirement properly.  A GTID-based slave on the same
      # master recovers and catches up (control).
      #
      --source include/have_innodb_binlog.inc
      --source include/master-slave.inc
       
      --connection slave
      call mtr.add_suppression("GTID starting position is required on master");
      call mtr.add_suppression("Error reading packet from server");
       
      --connection master
      CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (1);
      --sync_slave_with_master
       
      --echo #
      --echo # Switch the slave to MASTER_USE_GTID=NO at the start of the BiE binlog
      --echo #
      --connection slave
      --source include/stop_slave.inc
      CHANGE MASTER TO MASTER_USE_GTID=NO, MASTER_LOG_FILE='binlog-000000.ibb', MASTER_LOG_POS=4;
      --echo # BUG: CHANGE MASTER above and START SLAVE below succeed without any error
      START SLAVE;
       
      --connection master
      INSERT INTO t1 VALUES (2);
       
      --connection slave
      # The IO thread keeps reconnecting; wait until the slave error log shows a few
      # failed attempts.
      --let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.2.err
      perl;
        use Time::HiRes qw(sleep);
        my $f= $ENV{SEARCH_FILE};
        for (1..300) {
          open(F, $f) or die "$f: $!";
          my $n= grep { /GTID starting position is required on master/ } <F>;
          close(F);
          exit 0 if $n >= 3;
          sleep(0.1);
        }
        die "Timeout waiting for the 4246 error in $f\n";
      EOF
      --echo # The slave log reports the GTID requirement, repeatedly
       
      --let $io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
      --let $io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1)
      --let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
      --echo # Using_Gtid: $using_gtid
      --let $not_running= `SELECT '$io_running' != 'Yes'`
      --echo # IO thread not running: $not_running
      --echo # BUG: Last_IO_Errno is $io_errno (the 4246 error is only in the error log)
      SELECT COUNT(*) AS rows_on_slave FROM t1;
       
      --echo #
      --echo # Control: switching back to GTID positioning recovers
      --echo #
      --source include/stop_slave.inc
      CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
      --source include/start_slave.inc
      --connection master
      --sync_slave_with_master
      SELECT COUNT(*) AS rows_on_slave FROM t1;
       
      --connection master
      DROP TABLE t1;
      --source include/rpl_end.inc
      
      

      Attachments

        Issue Links

          Activity

            People

              knielsen Kristian Nielsen
              Deepthi ES Deepthi Eranti Sreenivas
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 5h 17m
                  5h 17m
                  Remaining:
                  0d
                  Logged:
                  Time Not Required
                  Not Specified

                  Git Integration

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