[MDEV-25762] RESET MASTER is very slow when using InnoDB Created: 2021-05-24  Updated: 2021-05-27

Status: Open
Project: MariaDB Server
Component/s: Replication, Storage Engine - InnoDB
Affects Version/s: 10.5
Fix Version/s: 10.6

Type: Bug Priority: Major
Reporter: Michael Widenius Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: None


 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.


Generated at Thu Feb 08 09:40:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.