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

create or replace table as select incorrect reference is followed by Waiting for table metadata locks

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.3.6
    • N/A
    • None
    • CentOS 7.4

    Description

      create or replace table as select incorrect reference is followed by Waiting for table metadata locks

      CREATE OR REPLACE TABLE t1 AS SELECT f1(); sticks
      and next SQL commands executed from other opened connections are hanging with
      Waiting for table metadata locks

      MariaDB [(none)]> drop database test1;
      Query OK, 1 row affected (0.178 sec)
       
      MariaDB [(none)]> create database test1;
      Query OK, 1 row affected (0.000 sec)
       
      MariaDB [(none)]> use test1;
      Database changed
      MariaDB [test1]> CREATE TABLE t1 (a INT);
      Query OK, 0 rows affected (0.107 sec)
       
      MariaDB [test1]>
      MariaDB [test1]> DELIMITER //
      MariaDB [test1]>
      MariaDB [test1]> CREATE FUNCTION f1() RETURNS VARCHAR(16383)
          ->
          -> BEGIN
          ->
          ->   INSERT INTO t1 VALUES(1);
          ->
          ->   RETURN 'test';
          ->
          -> END //
      Query OK, 0 rows affected (0.025 sec)
       
      MariaDB [test1]> DELIMITER ;
      MariaDB [test1]>
      MariaDB [test1]>
      MariaDB [test1]>
      MariaDB [test1]> CREATE OR REPLACE TABLE t1 AS SELECT f1();
      

      MariaDB [test1]> show processlist ;
      ERROR 2006 (HY000): MySQL server has gone away
      No connection. Trying to reconnect...
      Connection id:    9
      Current database: test1
      

      MariaDB [test1]> CREATE OR REPLACE TABLE t1 AS SELECT f1();
      ^CCtrl-C -- query killed. Continuing normally.
      

      MariaDB [(none)]> drop function test1.f1;
      

      MariaDB [ttcc]>  show processlist ;
      +----+-------------+-----------+-------+------------+------+-------------------------------------------+-----------------------------------------            --+----------+
      | Id | User        | Host      | db    | Command    | Time | State                                     | Info                                                  | Progress |
      +----+-------------+-----------+-------+------------+------+-------------------------------------------+-----------------------------------------            --+----------+
      |  1 | system user |           | NULL  | Daemon     | NULL | InnoDB purge coordinator                  | NULL                                                  |    0.000 |
      |  3 | system user |           | NULL  | Daemon     | NULL | InnoDB purge worker                       | NULL                                                  |    0.000 |
      |  2 | system user |           | NULL  | Daemon     | NULL | InnoDB purge worker                       | NULL                                                  |    0.000 |
      |  4 | system user |           | NULL  | Daemon     | NULL | InnoDB purge worker                       | NULL                                                  |    0.000 |
      |  5 | system user |           | NULL  | Daemon     | NULL | InnoDB shutdown handler                   | NULL                                                  |    0.000 |
      |  8 | root        | localhost | test1 | Killed     |  401 | Init                                      | CREATE OR REPLACE TABLE t1 AS SELECT f1(            ) |    0.000 |
      |  9 | root        | localhost | test1 | Field List |  388 | Waiting for table metadata lock           |                                                       |    0.000 |
      | 12 | root        | localhost | NULL  | Query      |  187 | Waiting for stored function metadata lock | drop function test1.f1                                |    0.000 |
      | 16 | root        | localhost | ttcc  | Query      |    0 | Init                                      | show processlist                                      |    0.000 |
      | 18 | root        | localhost | test1 | Field List |   19 | Waiting for table metadata lock           |                                                       |    0.000 |
      +----+-------------+-----------+-------+------------+------+-------------------------------------------+-----------------------------------------            --+----------+
      10 rows in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            People

              winstone Zdravelina Sokolovska (Inactive)
              winstone Zdravelina Sokolovska (Inactive)
              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.