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

RESET MASTER is very slow when using InnoDB

    XMLWordPrintable

Details

    Description

      The following test case shows the problem.
      This issue is experienced in all atomic tests and fixing it will speed these up notable!

      --source include/have_innodb.inc
      --source include/have_log_bin.inc
       
      # This test takes on a fast machine and ssd disks 20 seconds
      # 20 seconds with InnoDB and < 1 second with Aria
      # All time spent at RESET MASTER
      # It looks like there is a sleep() issue as 20 RESET MASTER takes ~20 seconds.
       
      let $engine="InnoDB";
       
      let $e= 0;
      while ($e < 20)
      {
        inc $e;
        --eval create table t1 (a int, b int, key(a)) engine=$engine
        insert into t1 values (1,1),(2,2);
        commit;
        flush tables;
        RESET MASTER;
        DROP TABLE t1;
      }
      


      The following patch for 10.6 fixes the slowdown (but has other problem). Thee patch is only for demonstrating where the problem is likely to be:

      --- a/sql/log.cc
      +++ b/sql/log.cc
      @@ -4331,6 +4331,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log,
           mysql_mutex_unlock(&LOCK_after_binlog_sync);
           mysql_mutex_unlock(&LOCK_commit_ordered);
      +#ifdef 0
           mark_xids_active(current_binlog_id, 1);
           do_checkpoint_request(current_binlog_id);
      @@ -4352,6 +4353,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log,
             no new ones will be written. So we can proceed to delete the logs.
           */
           mysql_mutex_unlock(&LOCK_xid_list);
      +#endif
         }
      

      It is probably the checkpoint request that is slow.

      Attachments

        Activity

          People

            Elkin Andrei Elkin
            monty Michael Widenius
            Votes:
            0 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.