Skip to content

DBOS should provide Sagas and compensation steps as a first class concept #63

@pranta

Description

@pranta

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:

  1. Book a hotel reservation
  2. Book a flight reservation
  3. 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.

  1. Book a hotel reservation. Push 'Cancel the hotel reservation' onto the Compensation stack.
  2. Book a flight reservation. Push 'Cancel the flight reservation' onto the Compensation stack.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions