Information Technology Reference
In-Depth Information
In executing an insert action IŒx;
v
in an update transaction T ,wefirst
unconditionally X-lock key x for commit duration and then use the procedure call
find-pages-for-insert
.P;x;T;
v
;y/to access and write-latch the set P of leaf pages
that contain the versioned tuples with key x and the key y next to x. The call also
ensures, by appropriate structure modifications, that the leaf page that covers the key
.x; T / has room for the versioned tuple .x; T;
v
/.Thekeyy is X-locked for short
duration in the usual way, first with a conditional lock request, and if this does not
succeed, with an unconditional request. The key y need not be one that is currently
present, because read actions observe deleted keys and S-lock them before moving
to the next key.
The commit-time table is read-latched, the set of records for the transactions that
created the versioned tuples with key x is retrieved from the commit-time table,
and the table is unlatched. Among the committed versioned tuples with key x,if
such tuples exist, let .x; T
0
;
v
0
/ be the one with the greatest commit time, and let
.x; T;
v
00
/ be the one created by T itself, if one exists. Again note that because of
commit-duration X-locking, there cannot exist any tuple .x; T
00
;
v
00
/ where T
00
6D
T
is an active transaction.
We have the following cases:
1. .x; T;
v
00
/ with
v
00
D?
exists. Then the last update on key x is a delete action by
T itself. The tuple .x; T;
v
00
/ is replaced by the tuple .x; T;
v
/ and the replacement
is redo-undo logged.
2. .x; T;
v
00
/ with
v
00
6D?
exists. Then T is logically inconsistent and must be
aborted.
3. .x; T;
v
00
/ does not exist but .x; T
0
;
v
0
/ with
v
0
D?
exists. Then the last update
on key x is a delete action by committed transaction T
0
. The tuple .x; T;
v
/ is
inserted and the insertion is redo-undo logged.
4. .x; T;
v
00
/ does not exist but .x; T
0
;
v
0
/ with
v
0
6D?
exists. Then the insert action
is illegal in this context and T must be aborted.
5. Neither .x; T;
v
00
/ nor .x; T
0
;
v
0
/ exists. The tuple .x; T;
v
/ is inserted and the
insertion is redo-undo logged.
Problems
12.1
When can old versions be purged from a transaction-time database, when
maintaining (a) transaction-level read consistency, (b) statement-level read consis-
tency, and (c) snapshot isolation?
12.2
Give log records for the forward-rolling update actions IŒx;
v
, DŒx;
v
,
and WŒx;
u
;
v
and for their undo actions I
1
Œx;
v
, D
1
Œx;
v
,andW
1
Œx;
u
;
v
,
performed on a transaction-time database.
12.3
When commit time is used as the basis of stamping and ordering the versioned
tuples, we need the separate commit-time table for mapping transaction identifiers