Analyzing Gap‑Lock Deadlocks in MySQL When Using MyBatis‑Plus saveOrUpdate
This article investigates how the MyBatis‑Plus saveOrUpdate method can trigger gap‑lock deadlocks in MySQL, explains the underlying concepts of deadlocks and gap locks, reproduces the issue with concrete SQL scripts, and proposes both risky and recommended mitigation strategies.
