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

Thread hang in 'Waiting for table metadata lock' on CREATE TABLE

    XMLWordPrintable

Details

    Description

      Not related to MDEV-29676. This bug affects all versions.

      --let $SOCKET= `SELECT @@global.socket`
      --source include/have_innodb.inc
      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      CREATE USER Spider@localhost IDENTIFIED BY 'PWD123';
      eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$SOCKET", DATABASE 'test', USER 'Spider', PASSWORD 'PWD123');
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      CREATE TABLE t1 (a INT) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv", TABLE "t"';
      LOCK TABLES t1 WRITE;
      --error 12622
      ALTER TABLE t1 CHANGE a b INT,ADD PRIMARY KEY(b);
      UNLOCK TABLES;  # Not necessary to reproduce, but increases severity
      CREATE TABLE t (a INT) ENGINE=InnoDB;
       
      DROP TABLE t, t1;  # Cleanup
      

      Leads to:

      10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

      ...
      10.11.0>ALTER TABLE t1 CHANGE a b INT,ADD PRIMARY KEY(b);
      ERROR 12622 (HY000): Can't use this operation before executing 'unlock tables'
      10.11.0>UNLOCK TABLES;
      Query OK, 0 rows affected (0.000 sec)
      10.11.0>CREATE TABLE t (a INT) ENGINE=InnoDB;  # Hangs
      

      10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

      10.11.0-dbg>SHOW FULL PROCESSLIST;
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+--------------------------------------+----------+
      | Id | User        | Host      | db   | Command | Time | State                                              | Info                                 | Progress |
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+--------------------------------------+----------+
      |  4 | root        | localhost | test | Query   |  164 | Waiting for table metadata lock                    | CREATE TABLE t (a INT) ENGINE=InnoDB |    0.000 |
      |  5 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      |  7 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      |  6 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      |  8 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      |  9 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      | 10 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      | 11 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      | 12 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 14 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 13 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 16 | system user |           | NULL | Sleep   |  164 | Reset for next command                             | NULL                                 |    0.000 |
      | 15 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 17 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 19 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 20 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      | 18 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 22 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 23 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 24 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                 |    0.000 |
      | 21 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                 |    0.000 |
      | 25 | Spider      | localhost | test | Sleep   |  164 |                                                    | NULL                                 |    0.000 |
      | 26 | root        | localhost | test | Query   |    0 | starting                                           | SHOW FULL PROCESSLIST                |    0.000 |
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+--------------------------------------+----------+
      23 rows in set (0.001 sec)
      

      Bug confirmed present in:
      MariaDB: 10.4.27 (dbg), 10.4.27 (opt), 10.5.18 (dbg), 10.5.18 (opt), 10.6.10 (dbg), 10.6.10 (opt), 10.7.6 (dbg), 10.7.6 (opt), 10.8.5 (dbg), 10.8.5 (opt), 10.9.3 (dbg), 10.9.3 (opt), 10.10.2 (dbg), 10.10.2 (opt), 10.11.0 (opt), 10.11.0 (dbg)

      Attachments

        Activity

          People

            ycp Yuchen Pei
            Roel Roel Van de Paar
            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.