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

MDL scalability regression after backup locks

Details

    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".

      Attachments

        Issue Links

          Activity

            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/
            
            

            marko Marko Mäkelä added a comment - 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/

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

            marko Marko Mäkelä added a comment - Possibly, this locking can be removed as part of implementing backup in the server process ( MDEV-14992 ).
            monty Michael Widenius added a comment - - edited

            I do not think it is possible to remove the backup lock in ha_commit_trans.
            This lock is essential to ensure that we can get a consistent backup, in any scenario (as far as I know).
            As long we support external backup tools, we need to have it, even if we have in server backup.
            It is also needed the lock to be able to create a consistent snapshot of the server.

            The lock is also critically needed for binlogs.

            It would be nice to be able to 'know in advance' that a backup will take place so that we could ignore all backup locks when there will not be any lock for existing transactions.
            What could be possible be done is to have a flag that disables all the backup locks. When we do BACKUP STAGE START, we would then enable the lock and wait for all transactions that was started outside of the lock to complete before continue.

            monty Michael Widenius added a comment - - edited I do not think it is possible to remove the backup lock in ha_commit_trans. This lock is essential to ensure that we can get a consistent backup, in any scenario (as far as I know). As long we support external backup tools, we need to have it, even if we have in server backup. It is also needed the lock to be able to create a consistent snapshot of the server. The lock is also critically needed for binlogs. It would be nice to be able to 'know in advance' that a backup will take place so that we could ignore all backup locks when there will not be any lock for existing transactions. What could be possible be done is to have a flag that disables all the backup locks. When we do BACKUP STAGE START, we would then enable the lock and wait for all transactions that was started outside of the lock to complete before continue.

            People

              Unassigned Unassigned
              svoj Sergey Vojtovich
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.