[MDEV-16206] create or replace table as select incorrect reference is followed by Waiting for table metadata locks Created: 2018-05-17  Updated: 2018-07-09  Resolved: 2018-07-09

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.3.6
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Zdravelina Sokolovska (Inactive) Assignee: Zdravelina Sokolovska (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

CentOS 7.4


Issue Links:
Relates
relates to MDEV-16204 Data inconsistency is observed on t... Closed

 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)



 Comments   
Comment by Elena Stepanova [ 2018-05-17 ]

Please retest after MDEV-11129 bug fix has been merged into 10.3.

Generated at Thu Feb 08 08:27:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.