Compensating Transaction
   HOME

TheInfoList



OR:

The execution of a
business process A business process, business method or business function is a collection of related, structured activities or tasks by people or equipment in which a specific sequence produces a service or product (serves a particular business goal) for a parti ...
consists of one or more transactions. Each transaction may consist of several individual operations yet, as a whole, it moves the system between consistent states. There are two groups of systems where compensating transaction may be applied: 1. In the context of a
database In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases sp ...
this is often easily achieved using transactions and the commit/
rollback In political science, rollback is the strategy of forcing a change in the major policies of a state, usually by replacing its ruling regime. It contrasts with containment, which means preventing the expansion of that state; and with détente, w ...
mechanism. Compensating transaction logic could be implemented as additional on top of database supporting commit/rollback. In that case, we can decrease business transaction granularity. 2. 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 committed to permanent storage, but may subsequently need to be rolled back, perhaps due to the user opting to cancel the operation. Unlike conventional rollbacks, specific business logic will typically be required to roll back a long lived transaction and restore the system to its original state. This type of transaction differs from
distributed transaction A distributed transaction is a database transaction in which two or more network hosts are involved. Usually, hosts provide transactional resources, while the transaction manager is responsible for creating and managing a global transaction that enc ...
s (often implemented using the two-phase-commit protocol), because although both types of transactions can result in multiple data stores being updated, compensating transactions allows for the updates to span a long period of time. Compensating transactions are often designed into Web services that participate in the execution of business processes that are part of a
service-oriented architecture In software engineering, service-oriented architecture (SOA) is an architectural style that focuses on discrete services instead of a monolithic design. By consequence, it is also applied in the field of software design where services are provide ...
solution.


See also

* Business Process Execution Language


References

{{DEFAULTSORT:Compensating Transaction Data synchronization Transaction processing