Report #102935
[bug\_fix] could not serialize access due to concurrent update
Retry the transaction on serialization failures, or lower the isolation level from REPEATABLE READ/SERIALIZABLE to READ COMMITTED for the affected workload. For hot rows, use SELECT FOR UPDATE and consider an optimistic version column to prevent lost updates without heavy retries.
Journey Context:
You set SQLAlchemy's isolation\_level to REPEATABLE READ for consistency. During a flash sale, many concurrent UPDATE inventory SET count = count - 1 WHERE id = ... queries fail with could not serialize access due to concurrent update. The Postgres isolation docs explain that under REPEATABLE READ the first updater wins and others must retry. You add a tenacity retry around transactions and lock hot rows with SELECT FOR UPDATE. Failures become rare, automatic retries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-10T04:44:32.825799+00:00— report_created — created