MySQL 1213 — Paullock found. appears when two transactions hold locks each waiting for release by the other. InnoDB detects this cycle, chooses a transaction as a victim and cancels so that the system can continue.
What does this error mean?
Transactions are blocking each other and one has to be cancelled.
Probable causes
Adding a timeout does not correct a. 8:40., because the problem is a cycle of locks, not a simple long wait. Also avoid deactivating transactions or of widening locks without understanding competition. Too long transactions, a different order of access between two paths of code and insufficient indexes are frequent causes.
Verification and resolution
Start by capturing the808 with the available InnoDB information, then identify the two.transactions., tables, indexes and queries involved. Compare the order in which they lock the lines and check if a missing index unnecessarily expands the number of lines covered. Frequency is important: an occasional8 does not have the same impact as a permanent loop.
How to validate the correction — MySQL 1213 — Paullock found.
Reduce transaction time, access resources in consistent order to competing paths, and improve indexes when the query plan locks too many lines. application must also know how to properly re-enter a victim transaction. After correction, repeat the load and check that the rate of the load is decreasing without degrading the consistency of the data.
FAQ — MySQL 1213 — Paullock found.
Does MySQL automatically choose a transaction to cancel?.
Yes, InnoDB detects the cycle and cancels a victim to release other transactions.
Does a longer timeout solve the problem?.
No. A808 is a cycle of locks and requires correcting the order, duration or scope of transactions.
Is L, application to handle error 1213?.
Yes, a retry-bound logic is usually required for the cancelled transaction.