Skip to main content

Forward/backward recovery; checkpointing

Short answer

Backward recovery rolls the system back to a previously saved consistent state (checkpoint), losing recent work; forward recovery corrects errors without going back, using techniques like error-correcting codes. Coordinated checkpointing uses a coordinator to request all processes to take tentative checkpoints, then makes them permanent; after a failure, all roll back to this consistent recovery line.

What do you mean by forward and backward recovery? How to implement coordinated check pointing for recovery in DS?

Backward recovery

The system is brought back to a previously saved correct state (a recovery point or checkpoint) and execution resumes from there. The state is recorded periodically by checkpointing and/or message logging. It is general-purpose and does not need to know which error occurred, but it has overhead (saving state), it loses the work done since the checkpoint, and it is impossible for some operations (e.g. once a cash dispenser has paid out money, that cannot be undone). Example: restoring a database from a checkpoint and replaying the log.

Forward recovery

The system moves to a new correct state from which it can continue, by correcting the error without going back. It requires knowing in advance which errors may occur. Examples: error-correcting codes, and erasure correction, where a lost packet is reconstructed from other, successfully delivered packets instead of being resent.

PointBackward recoveryForward recovery
IdeaRoll back to saved stateMove to new correct state
Error knowledgeNot neededNeeded in advance
OverheadCheckpoint cost, lost workLess, but designed per error
GeneralityGeneralSpecific
ExampleCheckpoint/restartError-correcting codes

Coordinated checkpointing for recovery

In coordinated checkpointing, all processes take their checkpoints together so that the set of checkpoints is a consistent global state.

Blocking two-phase protocol:

  1. The coordinator takes a local checkpoint and sends CHECKPOINT_REQUEST to all processes.
  2. A process receiving the request takes a tentative local checkpoint, stops sending application messages, and acknowledges.
  3. After receiving all acknowledgements, the coordinator sends CHECKPOINT_DONE; each process makes its checkpoint permanent, discards the old one and resumes.

Non-blocking alternative: the Chandy-Lamport marker algorithm records the states using markers sent along the channels.

Coordinator   P1   P2   P3
   request --> ... tentative ckpt
   <-- ack ---
   done ----> permanent, resume

On a failure, all processes roll back to the last permanent checkpoint. This set is consistent, so there is no domino effect, and only one checkpoint per process needs to be stored; the cost is the coordination messages and the blocking delay.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 9 questions →