If a deadlock occurs, how can this problem be solved? Find the original lock ID and KILL the thread that has been held all the time. But how can we find the thread ID that causes the deadlock among many threads? Since MySQL has developed
If a deadlock occurs, how can this problem be solved? Find the original lock ID and KILL the thread that has been held all the time. But how can we find the thread ID that causes the deadlock among many threads? Since MySQL has developed
If a deadlock occurs, how can this problem be solved? Find the original lock ID, and KILL the thread that has been held for a long time. The server space, but how can we find the thread ID that causes the deadlock? MySQL has been very powerful since its development. This problem is well solved. Directly link the data dictionary for search.
Let's demonstrate it.
Thread A, which is used to lock some records. Suppose this thread has never been committed, or forget to commit. It will always exist, but only the SLEEP status is displayed in the data.
Thread B, which is used for normal updates and website space, but has encountered a problem. At this time, I don't know which thread has locked this line of records?
The information above is huge, and you cannot see where it is.
But now, we only need to extract this part of information from the data dictionary.
It turns out that thread 16 has forgotten the COMMIT.
This article is from "God, website space, let's see it !" Blog, please keep this source