Posts

Showing posts from July, 2019

SLEEP thread causing "Waiting for table metadata lock"

Image
SLEEP thread causing "Waiting for table metadata lock"
We might have faced some scenarios once our db connection threads are getting locked and we try to find the culprit thread id which is locking the thread, to kill and release the connections. 
Here I am going to focus on one of the scenarios when db connection threads are locked at state "waiting for table metadata lock" and when we see the processlist, we can't find any thread which is running and using the same table, i.e., all threads are in SLEEP state except the locked threads.


Such as : 
mysql [localhost:5726] {msandbox} (world) > show processlist\G *************************** 1. row ***************************            Id: 5          User: rsandbox          Host: localhost:60624            db: NULL       Command: Binlog Dump          Time: 111519         State: Master has sent all binlog to slave; waiting for more updates          Info: NULL     Rows_sent: 0 Rows_examined: 0 *************************** 2. ro…