Transactions from the Application
Where a transaction boundary sits, how it propagates, whether a conflict is caught by a version check or a lock, and what may run after commit. Interviewers probe it because bugs here corrupt data.
on this pageshowhide
explore
- Demarcation & Propagation6 questions
- Read-Only Units & Routing6 questions
- Optimistic Versioning6 questions
- Pessimistic Lock Requests5 questions
- Errors, Rollback & Retry6 questions
- Commit Side Effects5 questions
questions
page 2 of 2Across a service, where should data-access failures be translated into domain outcomes, and what does leaking them cost?
basics
~20 sMap only the few failures the domain genuinely models, close to the code that knows the rule, and let the rest travel outward with their kind intact to a single handler. Blanket wrapping destroys the retry decision; blanket leaking spreads persistence vocabulary through every layer.
Would you route every read-only unit of work to a replica by default or make replica routing opt-in per unit, and what does each choice cost?
basics
~20 sRouting every read-only unit by default maximises offload but makes correctness depend on each marking also being stale-tolerant, which it never meant. Opt-in is safe and under-used; most systems vet a few paths and pin after writes.
When is an after-commit effect that can be lost acceptable, rather than writing the notification into the same unit of work?
basics
~20 sWhen the effect is reconstructible from committed state, cheap to redo, and its temporary absence costs only staleness. Effects that move money, are irreversible, or hold the only copy of something must be recorded inside the transaction instead.
How do you decide which rows in a model carry a version, and what does the granularity of that choice cost?
basics
~20 sPut versions where concurrent editing is real and where an invariant needs protecting. A version on a parent guards rules spanning its children but makes independent child edits collide; versions only on children collide less and guard nothing across rows.
showing 31–34 of 34