Analysis of MySQL deadlock (intermediate)


InnoDB actively detects the deadlock and rolls back a waiting transaction. The question is, how does InnoDB detect deadlocks?
The intuitive method is that when two transactions wait for each other, when the waiting time of one transaction exceeds a set threshold, one transaction is rolled back, and the other transaction can continue to execute. This method is simple and effective. In InnoDB, the parameter InnoDB is used_ lock_ wait_ Timeout is too laggy, and if there is a lot of deadlocks, it will cause more time wasting. The system will be stuck, so analyzing deadlocks is also a very important thing.
Deadlock detection is a life-saving straw given by InnoDB when deadlock occurs. We need it, but what we need more is the ability to avoid deadlock. How can we avoid it as much as possible? This requires understanding the locks in InnoDB.
I won’t write about the cause of deadlock. Let’s go to another blog…
How to find deadlock, how to avoid deadlock, which is written clearly!

This work adoptsCC agreementReprint must indicate the author and the link of this article

Recommended Today

Kafka source learning: Kafka APIs leader_ AND_ ISR

Link to the original text:…This source code is based on Kafka 0.10.2 Whenever the controller changes state, it will call thesendRequestsToBrokersMethod sendleaderAndIsrRequestThis paper mainly introduces the logic and process of Kafka server processing the request. LEADER_AND_ISR Overall logical process case ApiKeys.LEADER_AND_ISR => handleLeaderAndIsrRequest(request) Receive leader on server side_ AND_ After ISR request, thehandleLeaderAndIsrRequestThe processing flow […]