In this lesson · topic 7 of 7
Topic 7
Compensation, isolation and coordination
3 min read
Predict first
Predict first
Predict first
Take away
- A saga splits a transaction into local steps, each with a compensating action.
- On a failure the finished steps are undone in reverse order.
- A compensation is a new change. Some actions cannot be undone, so put them last.
- Sagas are atomic in the end and not isolated. Readers can see the middle, and a semantic lock or other design fixes it at a cost.
- Orchestration puts the flow in one place and costs messages. Choreography has none to spare and is hard to trace.
- Every step and compensation must be idempotent, and a stuck compensation needs a limit and a person.
Sources
- Hector Garcia-Molina and Kenneth Salem, Sagas, SIGMOD, 1987.
- Pat Helland, Life beyond Distributed Transactions: an Apostate’s Opinion, CIDR, 2007.
- Chris Richardson, Pattern: Saga, microservices.io.
- Philip A. Bernstein, Vassos Hadzilacos and Nathan Goodman, Concurrency Control and Recovery in Database Systems, Addison-Wesley, 1987.