Information Technology Reference
In-Depth Information
The mapping defined by this program fragment maps the constants x,
u
, y,
v
and
the current r to the relation obtained from r by inserting the tuples .x;
u
/ and .y;
v
/.
In serial execution, the sum computed by T
1
includes both of the values
u
and
v
if T
2
is executed first and includes neither of them otherwise. Both executions must
be regarded as correct.
However, if T
1
is run at an isolation level lower than full isolation (serializable),
the sum computed by T
1
may include only one of the values
u
and
v
. For example,
if x<yand T
1
scans r in ascending key order, it may happen that T
2
inserts .x;
u
/
after T
1
has already scanned a key greater than x,butinserts.y;
v
/ and commits
before T
1
has scanned the greatest key less than y. In this case
v
is included in the
sum, but
u
is not.
This phenomenon, called the
phantom phenomenon
, is possible if T
1
is run at an
isolation level that permits an isolation anomaly called “unrepeatable read.” It is up
to the application programmer to decide whether or not that is acceptable.
t
The
ACID
properties stated above only pertain to the logical database. The
database management system is solely responsible for maintaining
physical con-
sistency
, that is, integrity of the underlying physical database, regardless of whether
or not logical consistency is maintained. This means, for instance, that a B-tree
index structure for a relation is maintained in a consistent and balanced state even in
the presence of logically inconsistent transactions and process failures and system
crashes.
1.7
The Read-Write Model
In order to study transaction management in more detail, we need to define a
database and transaction model that specifies the actions that are used in transac-
tions. For the sake of simplicity, we assume that our logical database consists of
only one relation with the scheme r.X;V/. The tuples of the relation are pairs
.x;
v
/,wherex is the unique
key
of the record and
v
is the
value
of the tuple (i.e., the
values of the other attributes in the tuple). Transactions always operate on r 's tuples
using the key x.
In the simplest transaction model, called the
read-write model
, a transaction
on the database r can contain, besides the begin-transaction action B, the abort-
transaction action A, and the commit-transaction (or complete-rollback) action C ,
the following two types of forward-rolling database actions:
1.
Read actions
of the form
RŒx;
v
(1.5)
for reading the tuple .x;
v
/ with key x.Thekeyx is an input parameter for the
action. The action fetches the unique tuple .x;
v
/ with key x from r . If the tuple
is not found, the action fails. A shorthand notation for the action is RŒx.