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

GTT: Slave thread-hangs on 'Waiting for table metadata lock' on DROP TABLE

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      --source include/have_innodb.inc
      --source include/have_binlog_format_mixed.inc
      --source include/master-slave.inc
       
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      CREATE GLOBAL TEMPORARY TABLE gtt (c INT) ENGINE=InnoDB ON COMMIT PRESERVE ROWS;
       
      --source include/sync_slave_sql_with_master.inc
      --let $diff_tables= slave:gtt, slave:t
      --source include/diff_tables.inc
       
      --connection master
      TRUNCATE TABLE gtt;
      DROP TABLE t, gtt;
      --source include/rpl_end.inc
      

      Results in:

      MDEV-35915-v11 CS 12.2.0 8934bac9ea05b79f7a5109d9e980cb939a24d4e3 (Optimized, Replica, Clang 21.1.3-20250923) Build 19/01/2026

      MariaDB [(none)]> show processlist;
      +----+-------------+-----------------+------+-----------+------+------------------------------------------------------+-----------------------------------------------------------+----------+
      | Id | User        | Host            | db   | Command   | Time | State                                                | Info                                                      | Progress |
      +----+-------------+-----------------+------+-----------+------+------------------------------------------------------+-----------------------------------------------------------+----------+
      |  5 | root        | localhost:35408 | test | Query     |   13 | Waiting for the slave SQL thread to advance position | select master_pos_wait('master-bin.000001', 844, 300, '') |    0.000 |
      |  6 | system user |                 | NULL | Slave_IO  |   13 | Waiting for master to send event                     | NULL                                                      |    0.000 |
      |  7 | system user |                 | test | Slave_SQL |   13 | Waiting for table metadata lock                      | DROP TABLE `t`,`gtt` /* generated by server */            |    0.000 |
      |  8 | root        | localhost:35418 | test | Sleep     |   13 |                                                      | NULL                                                      |    0.000 |
      |  9 | root        | localhost:35430 | test | Sleep     |   13 |                                                      | NULL                                                      |    0.000 |
      | 10 | root        | localhost:59268 | NULL | Query     |    0 | starting                                             | show processlist                                          |    0.000 |
      +----+-------------+-----------------+------+-----------+------+------------------------------------------------------+-----------------------------------------------------------+----------+
      6 rows in set (0.000 sec)
      

      The MTR test will fail after 300 seconds due to timeout.
      The issue does not happen when using:

      CREATE TABLE gtt (c INT) ENGINE=InnoDB;
      

      Instead of the GTT DDL. Note that the issue may be triggered by internal MTR code. In any case, the DROP should not hang.

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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