Chained transaction : The chained transaction as the name implies introduces some form of linear control for sequencing through the tran...
Chained transaction :
The chained transaction as the name implies introduces some form of linear control for sequencing through the transaction . The simplest form of chaining is to use synchpoints which is known as save points . The synch points lets you to rollback the accumulated piece of work. And stile remains alive in the transaction. But commit ends a transaction. While there is a power failure the savepoints are not reliable . The commit is realiable in this place.
Chained transactions are a variation of synchpoints that make the accumulated work durable. They allow you to commit work while staying within the transactions . But the entire chain of work is not allowed to roll back.
Sagas extend the chained transaction to let you rollback the entire chain. They do that by maintaining a chain of compensating transactions . We can still get crash resistance of the intermediate commits but you have the choice of rolling back the entire chain under program control.
Nested transaction :
Nested transaction provide the ability to define the transactions within other transaction. They do that by breaking a transaction into hierarchies of sub transactions.
Each sub transactions can issue a commit or rollback for its designated pieces of work. When a sub transaction commits its results are only accessible to the parent that spawned it. A sub transactions commit is mad e permanent after it issues a local commit and all its ancestors commit. If a parent transactions rollback all its descendant transactions also rollbacks. The main benefit of nesting is that a failure in a sub transaction can be trapped and retried using an alternative method.