skip to content

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 pageshow

explore

questions

page 2 of 2

Across a service, where should data-access failures be translated into domain outcomes, and what does leaking them cost?

level: principalimportance: should knowfreq 38%

basics

~20 s

Map 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.

open as a page

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?

level: principalimportance: should knowfreq 42%

basics

~20 s

Routing 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.

open as a page

When is an after-commit effect that can be lost acceptable, rather than writing the notification into the same unit of work?

level: principalimportance: nice to knowfreq 42%

basics

~20 s

When 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.

open as a page

How do you decide which rows in a model carry a version, and what does the granularity of that choice cost?

level: principalimportance: nice to knowfreq 33%

basics

~20 s

Put 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.

open as a page

showing 31–34 of 34