-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Today, a DBOS workflow consists of a series of durable steps and the crash recovery is based on the resumption at the next unexecuted step.
However, there may be occasions, where it might be required to group a bunch of steps as a Saga which need to be Atomic (all or nothing) in nature. For example, a Trip Reservation Saga may consist of 3 steps:
- Book a hotel reservation
- Book a flight reservation
- Book a car reservation
Each of the above steps need to all succeed or all fail. So if an intermediate step fails, then all previous steps need to be compensated.
- Book a hotel reservation. Push 'Cancel the hotel reservation' onto the Compensation stack.
- Book a flight reservation. Push 'Cancel the flight reservation' onto the Compensation stack.
- Book a car reservation.
If there is a failure or a crash during Step 2 or Step 3, then the Compensation stack needs to be popped and Compensations need to be executed in reverse order to achieve Atomicity of the Saga.
The recovery will also need to become Saga-aware and compensation-capable.