Jump to content

Compensating transaction

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Linda2zh (talk | contribs) at 09:48, 7 November 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

When processing data it is an useful abstraction to split the processing in transactions: where each transaction may consists of several individual operations, but must move the system data among consistent states. In the context of a database this is easily achieved using transactions and the commit/rollback mechanism. For systems where there isn't any Commit/rollback mechanism available one can undo a failed transaction with a Compensating Transaction, which will bring the system back in the initial state. It is just a workaround which has to be implemented manually and cannot guarantee that the system always ends in a consistent state. What if the Compensating Transaction also fails? Depending on the situation (regulation, criticality, development team skills, budget...) an implementation will strive to achieve more or less reliability. A minimal requirement in case of failure is to expose the fact in some way: logging, email, ...