Analysis of MySQL Deadlock Issues in Multi-threaded Scenarios
The article investigates a MySQL deadlock that arises when multiple threads concurrently execute INSERT … ON DUPLICATE KEY UPDATE for logistics cancellations, reproduces the issue on MySQL 5.7 and 8.0, analyzes InnoDB lock handling and internal mini‑transactions, and explains how batch processing of each value leads to the deadlock.