[MDEV-21820] create table ... select is metadata locking information_schema Created: 2020-02-26 Updated: 2022-01-07 Resolved: 2022-01-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.4.8 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Rick Pizzi | Assignee: | Sergei Golubchik |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
When issuing a CREATE TABLE .... SELECT, the information schema becomes unusable because it gets metadata-locked. This is creating issues to monitoring systems that normally query information_schema for monitoring purposes (queries stack up in processlist waiting for metadata lock). How to reproduce: In terminal 1:
In termninal 2:
|
| Comments |
| Comment by Marko Mäkelä [ 2020-02-27 ] | |
|
I would guess that CREATE TABLE…SELECT is unnecessarily holding MDL_EXCLUSIVE on the table name for the duration of the entire operation. That ought to block SHOW TABLES as well. Related to this, we have another problem with CREATE TABLE…SELECT, which requires a problematic work-around in InnoDB, as mentioned in
| |
| Comment by Sergei Golubchik [ 2022-01-07 ] | |
|
It cannot be done, the table isn't completely created yet, so an exclusive metadata must be held to protect table metadata. If you want to query INFORMATION_SCHEMA.TABLES while some tables are being created, you can use
this will be fast, it'll skip all exclusively locked tables, which you might like better than waiting. |