[MDEV-26600] Waiting for table metadata lock Created: 2021-09-13 Updated: 2022-01-29 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Locking, Storage Engine - MyISAM |
| Affects Version/s: | 10.2.22 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Abhay Singh | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | performance | ||
| Environment: |
NAME="openSUSE Leap" |
||
| Attachments: |
|
| Description |
|
DML query is stuking with status "Waiting for table metadata lock", don't see any thing in mysql log for this, then engine of the table is MyISAM
no other query running on this table which might be causing this lock. |
| Comments |
| Comment by Daniel Black [ 2021-09-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Is this repeatable? Can you install the debug symbols (https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/#installing-debug-info-packages-with-zypper) and obtain a backtrace when this occurs again https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/#getting-backtraces-from-a-running-mysqld-process-with-gdb-on-linux ? | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abhay Singh [ 2021-09-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
mysqlBacktraces.zip | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2021-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks abhaysingh, I narrowed it down to the below two threads potentially in deadlock.
If its not that second thread then its one of the other background threads. This would be easier to read if the debug symbols here installed:
If you get a chance to install and recapture the trace please do so. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abhay Singh [ 2021-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Daniel, the debug info is already installed and I have captured trace after installing | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abhay Singh [ 2021-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
the two threads you have mentioned are two different cases of the same problem that I have mentioned, one thread is with one table, and in another, it's with another table, both tables are not related and no other queries were running or any other processes running. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abhay Singh [ 2021-09-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
here is same case but with different table, see if you can see something common here mysqld_full_bt_all_threads_2021-09-18.txt.zip | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abhay Singh [ 2021-09-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Daniel, do you have any updates/suggestions to try. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Larry Adams [ 2022-01-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
I've been having the same issue on 10.5.8, 10.5.9, and now 10.5.13. What I can confirm is the following scenario.
My suspicion is that there is a timing issue around the flagging of processes to the MDL status, and that the query that had just been started, was marked as running, but in fact, under the covers it's blocked (by some internal flag in a private structure). So, it's likely either a lack of a MUTEX or SEMAPHONE LOCK around the MDL/LOCK/UNLOCK process. It's quite consistent, and I've been having to implement mitigations to keep the system running well when the MDL takes place as there are just too many queries coming from too many directions to be able to "quies" the system before running the OPTIMIZE for example, which is the most frequent MDL transaction I run on the system. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Larry Adams [ 2022-01-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Secondly, one potential workaround would be to decrease the WAIT_TIMEOUT or INTERACTIVE_TIMEOUT to something less than what it is, but we have some very long running queries that are commonplace on the system at around the same time as the MDL transactions roll in. So, setting those values low in a global fashion is problematic. |