Jump to content

Compensating transaction

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 219.89.26.171 (talk) at 06:57, 31 July 2008. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

When processing data it is useful to split the processing into transactions, where each transaction may consist of several individual operations yet, as a whole, moves the system between consistent states. In the context of a database this is often easily achieved using transactions and the commit/rollback mechanism.

For systems without a commit/rollback mechanism available, one can undo a failed transaction with a Compensating Transaction, which will bring the system back to its initial state. Typically, this is only a workaround which has to be implemented manually and cannot guarantee that the system always ends in a consistent state. The system designer may need to consider what happens if the compensating transaction also fails.

Compensating Transactions are also used in case where a transaction is long lived (commonly called Saga Transactions), for instance in a business process requiring user input. In such cases data will be commited to permanent storage, but may subsequently need to be rolled back.