Information Technology Reference
In-Depth Information
SQL
that have no explicit request for starting a transaction, the first read or update
action triggers the begin-transaction action as the first action of the transaction.
A forward-rolling transaction can be continued with read and update actions until
a commit or an abort action is performed. The state of a
committed transaction
is an
action sequence of the form
B˛C;
(1.2)
where B and ˛ are as in a forward-rolling transaction and C is the
commit-
transaction
action, the result of a successfully processed
commit
request. A
committed transaction cannot be continued with any more actions.
The state of a
backward-rolling transaction
is an action sequence of the form
B˛LJALJ
1
;
(1.3)
where B˛LJ is the state of a forward-rolling transaction, A is the
abort-transaction
action, and LJ
1
is a sequence of undo actions for the suffix LJ of the forward-rolling
action sequence ˛LJ. The action sequence LJ
1
forms the
backward-rolling phase
of
the transaction. Such a transaction has rolled back the forward-rolling update actions
in LJ; the update actions in ˛ are still to be undone.
The abort action can be seen as marking the start of the service of an
SQL
rollback
request or the start of the rollback of a transaction aborted due to an outside
event such as a system failure. The service of the
rollback
request also includes
performing the backward-rolling phase of the transaction back to the undo action
for the first forward-rolling update action, after which it marks the transactions as
rolled back.
The
undo sequence
for a forward-rolling action sequence LJ, denoted LJ
1
or
undo
.LJ/, consists of undo actions for the sequence of update actions o
1
o
2
:::o
n
contained in LJ, in reverse order:
undo
.LJ/
D
LJ
1
D
o
n
o
1
n1
:::o
1
D
undo
.o
n
/
undo
.o
n1
/:::
undo
.o
1
/:
The
undo action
or
inverse action
for an update action o is defined separately for
each action:
1.
undo
(insert tuple t into r )
D
delete t from r .
2.
undo
(delete tuple t from r )
D
insert t into r .
3.
undo
(change the value of attribute A in tuple t of r from
u
to
v
)
D
restore the
value of attribute A in tuple t of r to
u
.
4.
undo
(create relation r.Z/ in the database)
D
drop empty relation r.Z/ from the
database.
5.
undo
(drop empty relation r.Z/ from the database)
D
create relation r.Z/ in the
database.
Unlike a forward-rolling transaction, a backward-rolling transaction cannot be
continued arbitrarily. The next action to be performed is always uniquely defined: