Why Must a Database Retry Repeat the Decision, Not Just the Last Write?
Two workers inspect the same remaining capacity and each decides that one more booking can fit. A database rejects one transaction because the concurrent operations cannot be accepted under the chosen isolation rules. The application retries only the final update, using the decision it made before the conflict.
That retry may repeat the wrong unit of work. A concurrency failure can invalidate the inputs used to choose the write. The review needs to cover the read, the decision and the write together.
Identify the decision inside the transaction
The PostgreSQL serialization-failure documentation states that serialization failures use SQLSTATE 40001 and that applications should retry the complete transaction, including logic that chooses statements and values. It also notes that retries may fail again and that other error categories require more care.
This is specific database guidance, not a rule that every API error should trigger a retry. The application must recognize the actual error and the transaction boundary used by its database and client library.
Ask the implementation team to show a business operation as three steps: read relevant state, decide what is allowed and write the result. Identify which steps are repeated after a serialization failure. A retry wrapper around the final statement may leave the earlier decision unchanged.
Example: capacity changes between attempts
Use an illustrative system with one remaining appointment slot and two concurrent requests. Each initially observes availability. One commits successfully; the other encounters the serialization failure.
On the second attempt, the rejected operation should evaluate the current state again. Its legitimate outcome may now be “no capacity available,” not a successful booking. A retry is a chance to reevaluate safely; it is not a promise to preserve the first attempt's answer.
Specify the business result after reevaluation
Document the possible outcomes of the complete operation: accepted, rejected by a current business rule, retry budget exhausted or uncertain for another reason. Keep them distinct in the response and operating records.
A client should not receive a generic technical failure when the reevaluated business result is simply that capacity is gone. Conversely, an exhausted retry budget should not be presented as proof that the user's request was invalid.
Include the stable operation identifier in diagnostic records where appropriate. It should let the team connect several attempts to one business request without treating every attempt as a separate customer action.
Keep external effects out of assumptions
Inspect whether the transaction's decision logic also sends an email, calls a partner API or writes to another system. A database rollback does not automatically undo an external effect.
The team needs an explicit design for those effects, such as a durable handoff processed after commit with duplicate prevention. Select the mechanism from the actual architecture. This guide's review question is simply whether repeated transaction attempts can repeat an externally visible action.
Rehearse contention deliberately
Use a controlled test with two workers competing for the same synthetic resource. Capture each attempt's read state, decision, database outcome and final business response.
Run the test with a conflict that resolves quickly and another that persists beyond the permitted retry window. Verify that the latter stops with an observable result rather than occupying resources indefinitely.
Check the actual driver behavior. Some frameworks provide transaction helpers, but their retry scope and supported error categories should be confirmed in their current documentation. Do not assume a helper repeats application decisions that were calculated outside its callback.
Bound retries and preserve useful evidence
Choose attempt and time limits appropriate to the operation. Record why those limits fit the user experience and the expected contention. The objective is to preserve correctness while keeping resource use and waiting understandable.
Track retry rates as a diagnostic signal. A sustained increase may justify investigating contention or transaction design rather than simply raising the limit. Avoid interpreting every retry as an incident; assess the observed pattern and its customer impact.
The handover should state which error is recognized, which code is rerun, which effects are protected and what happens when the budget is exhausted. Include evidence from the concurrent rehearsal.
For a business review, ask the team to explain one failed first attempt and the decision made on its second attempt. If they can only show that the last write eventually succeeded, the most important part of the retry contract may still be untested.
Continue with the related FutureOS guide for the related planning decision.
The published FutureOS introduction describes the project as being in prelaunch. Use this guide to prepare a concrete project discussion; it does not announce an available FutureOS feature.
Prepared with AI assistance. Primary sources checked on October 24, 2026. Examples and procedures are illustrative editorial guidance, not FutureOS product announcements or an independently reviewed assessment.



Comments