[MDEV-19749] MDL scalability regression after backup locks Created: 2019-06-13  Updated: 2023-12-12

Status: Open
Project: MariaDB Server
Component/s: Locking
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.6

Type: Bug Priority: Major
Reporter: Sergey Vojtovich Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: performance, regression-10.4

Issue Links:
Problem/Incident
is caused by MDEV-5336 Implement BACKUP STAGE for safe exter... Closed
Relates
relates to MDEV-14992 BACKUP: in-server backup Open

 Description   

In 7a9dfdd GLOBAL and COMMIT namespaces were combined into BACKUP, which doubled load on BACKUP lock mutex.

Can be fixed by implementing something similar to MySQL WL#7306 "Improve MDL performance and scalability by implementing lock-free lock acquisition for DML".



 Comments   
Comment by Marko Mäkelä [ 2021-07-21 ]

The following patch has been used during some performance testing to remove the scalability bottleneck due to backup locks, so that we can better highlight scalability bottlenecks inside storage engines.

diff --git a/sql/handler.cc b/sql/handler.cc
index eb7b5b8..012ef20 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1567,7 +1567,7 @@ int ha_commit_trans(THD *thd, bool all)
   DBUG_PRINT("info", ("is_real_trans: %d  rw_trans:  %d  rw_ha_count: %d",
                       is_real_trans, rw_trans, rw_ha_count));
 
-  if (rw_trans)
+  if (0 && rw_trans)
   {
     /*
       Acquire a metadata lock which will ensure that COMMIT is blocked
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index c41e08e..f9e3f34 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2100,7 +2100,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
   }
 
   if (!(flags & MYSQL_OPEN_HAS_MDL_LOCK) &&
-      table->s->table_category < TABLE_CATEGORY_INFORMATION)
+      table->s->table_category < TABLE_CATEGORY_INFORMATION && 0)
   {
     /*
       We are not under LOCK TABLES and going to acquire write-lock/

Comment by Marko Mäkelä [ 2023-12-12 ]

Possibly, this locking can be removed as part of implementing backup in the server process (MDEV-14992).

Generated at Thu Feb 08 08:54:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.