GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

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... Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

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. ===Long-running transactions (Sagas)=== Compensating transactions are fundamental to the saga pattern. A saga is a sequence of local transactions where each transaction updates data within a single service and publishes an event. If a local transaction fails for any reason, the saga executes a series of compensating transactions to revert the changes made by the preceding local transactions. This pattern is essential for processes that are long-lived, such as a trip-booking process that involves coordinating flights, hotels, and car rentals. Because these operations might span a long period and involve multiple independent web services, holding database locks is impractical. Instead, each service commits its transaction and has a compensating transaction ready in case a subsequent step fails. This differs from distributed transactions using the two-phase-commit protocol, as it avoids locking resources for extended durations. ==See also== ACID Business Process Execution Language (BPEL) Two-phase commit protocol ==References==

source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Compensating transaction". 1761467211. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1318840851

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·