Skip to content

Symptom triage

Production transaction bugs announce themselves as one of five symptoms. Each row maps a symptom to the lesson that proves the mechanism and the lesson that fixes it — this page is the index you paste into the incident channel.

SymptomFirst checkMechanismFix
Updates hang, then finishWho is blocking whomlock queuesend the blocker; shorter transactions
Updates hang, then errno 1205Who is blocking whomlock wait timeout — statement rollback only!retry after ROLLBACK; find the blocker
Errno 1213 in the logsthe deadlock counterdeadlocks, gap locksconsistent lock order; retry loop
INSERTs stuck with no row conflictdata_locks for GAP / INSERT_INTENTIONgap locksREAD COMMITTED for the writer, or narrower locking reads
Numbers wrong, no errors anywherethe anomaly cataloglost updates, write skewthe three fixes
Disk grows, queries don't slowhistory list healthan old read view pins purgeend the long transaction
DDL hangs and takes the app with itprocesslist: Waiting for table metadata lockmetadata lockslock_wait_timeout on the DDL session

Two MySQL-specific reflexes are worth building on top of that table. Start with this one: errors that look alike often aren't. 1205 rolls back a single statement and leaves the transaction open, still holding its locks, while 1213 rolls back the whole transaction. Handling the two identically is pitfall material.

The second reflex: silence isn't health. The costliest failures on this table — lost updates, write skew, purge lag — throw no error at all, so you catch them with counters and invariant checks, never by grepping logs.

Further reading

MIT Licensed · Every transcript on this site was generated by a real database run against MySQL 8.4.10 and PostgreSQL 18.4 at bd6f201, and re-proven through psycopg and PyMySQL.