Company
Date Published
Author
Emily Fortuna
Word count
1599
Language
English
Hacker News points
7

Summary

The compensating action pattern is a design pattern for handling failure amongst distributed but related services. It provides transaction-like guarantees for a sequence of operations in distributed systems by either letting the sequence run successfully to completion or undoing state changes made by executed operations if there's a failure. This sequence of steps is called a "long-running transaction". Compensating actions are an important component of the saga design pattern, which ensures that there is a way to "go backwards" (undo) and end up with a consistent state in case of failure.