Skip to main content

Module deadlock

Module deadlock 

Source
Expand description

Deadlock and serialization failure detection utilities.

“Always be prepared to re-issue a transaction if it fails due to deadlock. Deadlocks are not dangerous. Just try again.” — MySQL 8.0 Reference Manual, InnoDB Deadlocks

InnoDB detects deadlocks instantly and rolls back one transaction (the victim). SQLSTATE 40001 signals a serialization failure that is always safe to retry. This module provides detection helpers for use by callers that manage their own transaction lifecycle (e.g., the outbox sequencer, hierarchy mutations).

Functions§

is_deadlock
Returns true if the error contains SQLSTATE 40001.
is_serialization_failure
Returns true if the error is a retryable serialization failure.