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

Replication tests fail with ER_BINLOG_IN_USE when run after another test

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q1/2027 Replic. Maintenance

    Description

      I've made it critical because it is going to be failing in buildbot, it will be pain.

      12.3 b1b9e036010876586b7d7d0684e6c650792ddd3a

      Logging: ./mtr  multi_source.mix_semisync_async --repeat=2 --mem
      ...
      worker[01] Using MTR_BUILD_THREAD 300, with reserved ports 19000..19029
      multi_source.mix_semisync_async          [ pass ]    845
      multi_source.mix_semisync_async          [ 2 fail ]
              Test ended at 2026-11-27 00:37:43
       
      CURRENT_TEST: multi_source.mix_semisync_async
      mysqltest: At line 23: query 'RESET MASTER' failed: ER_BINLOG_IN_USE (4243): Cannot execute RESET MASTER as the binlog is in use by a connected slave or other RESET MASTER or binlog reader. Check SHOW PROCESSLIST for "Binlog Dump" commands and use KILL to stop such readers
       
      The result from queries just before the failure was:
      # Setup
      connect  master1, 127.0.0.1, root, , , $SERVER_MYPORT_1;
      SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
      SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
      SET @@SESSION.gtid_domain_id= 1;
      RESET MASTER;
      connect  master2, 127.0.0.1, root, , , $SERVER_MYPORT_2;
      SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
      SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
      SET @@SESSION.gtid_domain_id= 2;
      RESET MASTER;
      

      In the run above, it fails upon the second execution, that is when it's run after itself; however it can also happen when it runs after a different test without server restart in between.

      The failure is not deterministic, but it happens fairly easily, especially in the conditions of high concurrency.

      The test was added by the commit

      commit 40cae5d6ed5f6419f11989a0b3df571fe73fba18
      Author: ParadoxV5 <paradox.ver5@gmail.com>
      Date:   Sun Oct 11 14:59:35 2026 -0600
       
          MDEV-32947 Async conflicts with semi-sync in multi-source
      

      but it only fails as described on 12.3 (and probably higher).
      Below is the relevant part of Claude's analysis. I don't guarantee its correctness, as it was wrong in some other aspects of this investigation.

        - 12.3 changed RESET MASTER. The binlog-in-engine commit (7081f2a58ec) added a check in MYSQL_BIN_LOG::reset_logs() in sql/log.cc. RESET MASTER
          now fails with ER_BINLOG_IN_USE while any binlog dump thread is still registered, even an idle one whose slave has already disconnected. Before
          12.3, such leftover threads didn't block it, so the test passes on 10.11 through 12.2. 
        - That commit also updated the test framework for this: include/rpl_init.inc and include/rpl_reset.inc now kill dump threads before RESET MASTER,
          and there is a new include/reset_master.inc that kills them and retries. mix_semisync_async uses none of these.
       
        Suggested fix (test only): replace both RESET MASTER; lines with --source include/reset_master.inc. Also add --source 
        include/kill_binlog_dump_threads.inc on master1 and master2 in the cleanup, so the next test or an MTR retry starts clean. The .result file needs
        re-recording because the include prints its name. reset_master.inc doesn't exist in 10.11 through 11.8, so a fix made on the 10.11 branch itself
        should use kill_binlog_dump_threads.inc before each RESET MASTER instead.
      

      Attachments

        Issue Links

          Activity

            People

              elenst Elena Stepanova
              elenst Elena Stepanova
              Elena Stepanova Elena Stepanova
              Jimmy Hú Jimmy Hú
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 1d 3h 41m
                  1d 3h 41m
                  Remaining:
                  Remaining Estimate - 1d 3h 41m
                  1d 3h 41m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                  Git Integration

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