Compensating transaction

In transaction processing and distributed computing, a compensating transaction is a transaction that reverses the effects of a previously committed transaction. It is a core concept in the saga design pattern, used to maintain data consistency across multiple services or databases in scenarios where traditional ACID transactions are not feasible or practical.

A compensating transaction is necessary when a business process, which may consist of several individual transactions, fails after one or more of its steps have already been successfully completed (committed). Unlike a database rollback, which discards uncommitted changes, a compensating transaction is a new transaction that applies business logic to semantically undo the work of a completed transaction, thereby restoring the system to a consistent state.


© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search