Transaction boundaries, commits and rollbacks

45 min
0/4 practice checks

Transaction boundaries, commits and rollbacks

A transaction boundary marks the start and end of one coherent business action. It should include every read and write needed to preserve the relevant rule, but not unrelated slow work such as waiting for a user to type a message. Boundaries that are too small allow partial updates; boundaries that are unnecessarily large increase lock time and conflict risk.

Commit makes a successful transaction durable. Rollback discards work when a rule, constraint or external step fails. In distributed systems, external services may not share the same transaction, so developers need a recovery design such as recording a pending payment and reconciling it rather than pretending every network call is instantly atomic.

Worked reasoning. A transfer moves R100 from Account A to Account B. The transaction checks A has funds, subtracts R100, adds R100 to B and commits. If adding to B fails, rollback restores A’s original balance. A separate receipt email can be retried later because email delivery should not keep money locked.

Exam lens. Draw the transaction boundary around the invariant. Then say what is committed, what is rolled back and what needs a separate recovery path.

Which statement is the most defensible principle for Transaction boundaries, commits and rollbacks?

Enter the key term for Transaction boundaries, commits and rollbacks. What action undoes a transaction’s uncommitted changes after a failure?

A stock update succeeds but a required order row fails validation. What should the transaction do?

Name the concise safeguard or principle that completes this lesson’s scenario: A stock update succeeds but a required order row fails validation. What should the transaction do?