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

Thread hang in 'Waiting for table metadata lock' on INSERT

    XMLWordPrintable

Details

    Description

      --let $SOCKET= `SELECT @@global.socket`
      --source include/have_innodb.inc
      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      CREATE USER Spider@localhost IDENTIFIED BY 'PWD1';
      GRANT ALL PRIVILEGES ON test.* to Spider@localhost;
      eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$SOCKET",DATABASE 'test',user 'Spider',PASSWORD 'PWD1');
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
      CREATE TABLE t3 (c INT) ENGINE=InnoDB;
      LOCK TABLES t2 WRITE;
      --error 1428
      LOCK TABLES mysql.proc WRITE,mysql.user WRITE;   # ERROR 1428 (HY000): You can't combine write-locking of system tables with other tables or lock types
      INSERT INTO t3 SELECT * FROM t;
      

      Leads to:

      10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Optimized)

      10.11.2-opt>SHOW FULL PROCESSLIST;
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+--------------------------------+----------+
      | Id | User        | Host      | db   | Command | Time | State                                              | Info                           | Progress |
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+--------------------------------+----------+
      |  4 | root        | localhost | test | Query   |  272 | Waiting for table metadata lock                    | INSERT INTO t3 SELECT * FROM t |    0.000 |
      |  5 | system user |           | NULL | Sleep   |  272 | Reset for next command                             | NULL                           |    0.000 |
      |  6 | 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 |
      |  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 |
      | 11 | 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 |
      | 12 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                           |    0.000 |
      | 13 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                           |    0.000 |
      | 14 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                           |    0.000 |
      | 15 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                           |    0.000 |
      | 16 | 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 |
      | 18 | 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 cardinality action handler | NULL                           |    0.000 |
      | 21 | 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 |
      | 25 | Spider      | localhost | test | Sleep   |  272 |                                                    | NULL                           |    0.000 |
      | 26 | root        | localhost | test | Query   |    0 | starting                                           | SHOW FULL PROCESSLIST          |    0.000 |
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+--------------------------------+----------+
      23 rows in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              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.