Information Technology Reference
In-Depth Information
the undo action for the last forward-rolling update action still undone is the one to
be performed next. Thus, any backward-rolling transaction will eventually enter in a
state in which all its forward-rolling updates have been undone; then the transaction
is recorded to have rolled back.
The state of a rolled back transaction is an action sequence of the form
B˛A˛ 1 C;
(1.4)
where B˛A˛ 1 is the state of a backward-rolling transaction and the C action marks
the transaction as being rolled back. Thus, a rolled back transaction has, as a result
of its backward-rolling phase ˛ 1 , rolled back all of its forward-rolling updates.
The definition of a rolled back transaction implies that such a transaction has
no permanent effect on the state of the logical database: whatever updates it does
in its forward-rolling phase are all undone in the backward-rolling phase. As will
be seen later, the physical database that stores the logical database, however, is not
necessarily restored into its original state by the undo actions. Note, for example,
that undoing a tuple deletion need not bring the tuple back to its original data page
but may insert it to some other page allocated to the same relation.
We use the same action name, C , to mark the end of both committed and rolled
back transactions. This is because from the point of view of transaction processing,
the same procedure is performed in both cases, only the result indication to be
returned to the application being different.
A committed or rolled back transaction is said to be terminated . A terminated
transaction cannot be further advanced with any action. A forward-rolling or
backward-rolling transaction is active . A backward-rolling or rolled back transac-
tion is aborted .
Example 1.2 Let us change the embedded SQL fragment of Example 1.1 so that
instead of committing the transaction, it is aborted and rolled back:
exec sql update r set V = 2 V ;
exec sql select sum (V ) into : new_sum from r ;
exec sql rollback .
The following action sequence is generated:
BR Œx 1 ; v 1 W Œx 1 ; v 1 ;2 v 1 RŒx 2 ; v 2 W Œx 2 ; v 2 ;2 v 2 :::RŒx n ; v n W Œx n ; v n ;2 v n
RŒx 1 ;2 v 1 RŒx 2 ;2 v 2 :::RŒx n ;2 v n
AW 1 Œx n ; v n ;2 v n :::W 1 Œx 2 ; v 2 ;2 v 2 W 1 Œx 1 ; v 1 ;2 v 1 C:
Here an undo action W 1 Œx i ; v i ;2 v i restores the previous V value v i of the tuple
with key x i .
Should instead a system failure occur during performing the update statement,
the following transaction is generated, assuming that the update on tuple .x i ; v i /
is the last that is found recorded (in the log saved on disk) at the time the system
recovers from the failure:
BR Œx 1 ; v 1 W Œx 1 ; v 1 ;2 v 1 RŒx 2 ; v 2 W Œx 2 ; v 2 ;2 v 2 :::RŒx i ; v i W Œx i ; v i ;2 v i
AW 1 Œx i ; v i ;2 v i :::W 1 Œx 2 ; v 2 ;2 v 2 W 1 Œx 1 ; v 1 ;2 v 1 C:
Search WWH ::




Custom Search