Nested Transactions
Nested Transactions
transactions.
Different Types
Closed Nesting
A transaction may have multiple concurrent children.
Using the log model, if a child commits, we append its log to its
parents log.
If a child aborts, we undo its actions and discard its log.
A child abort does not abort its parent, though the parent may be
notified of the abort and take alternative action of its choosing,
including aborting itself.
One interesting property of the closed nesting model is that a
childs operations are deemed never to conflict with operations of
its parent (or any ancestor).
Linear Nesting
We restrict a transaction to have at most one child at a time.
The tree of running descendants of any transaction is a line, not a
general tree structure.
One can identify a transaction solely by a top-level transaction id
(the original ancestor of the transaction) plus a nesting level.
This greatly simplifies determining ancestor-descendant
relationships in hardware, and also permits some useful further
optimizations.
Open Nesting
Operations are considered at a higher level of abstraction.
Open-nested transactions are allowed to commit to the shared
memory independently of their parent transactions, optimistically
assuming that the parent will commit.
Use compensating action to undo the childs forward action at a
higher-level of abstraction
E.g., malloc() compensated by free()
Rules:
When the child transaction is active, parent transaction
transaction is committed.
Parent can see the modifications.
These modifications are hidden until parent also commits.
same.
The locks are held by the parent transaction until it
commits.
The depth of the nested transaction is limited by memory.
A transaction is a unit of atomicity i.e. either all, or none of
Example:
BEGIN TRAN Tran1
GO
BEGIN TRAN Nested Tran
GO
INSERT INTO Table1 DEFAULT Values
GO 10
COMMIT TRAN Nested Tran
SELECT * FROM Table1
We get back 10 results.
most transaction.
Since we rolled back the outer transaction, the entire
transaction is rolled back no matter what we did in
between.
If we had committed Tran1, then the nested transaction
would have also commited.
Example:
We may organize sending a mail to multiple recipients as a
top-level transaction T where sending a mail to an individual
recipient is done in subtransactions to T.
When all subtransactions to T have completed T may decide
if sending the mail should be aborted or tried committed. This
decision can depend on which subtransactions made a
provisionary commit (ie: who received the mail).
THANK YOU