Database Reference
In-Depth Information
are rare, such additional overhead is unnecessary. In these environments, we can
adopt different techniques based on this optimistic assumption. Because no locking
is involved optimistic techniques allow greater concurrency.
In optimistic concurrency control techniques, no checking is done during trans-
action execution; verification is put off until a validation phase. In this later phase,
a check determines whether a conflict has occurred. If so, the transaction is aborted
and restarted. Restarting may be time-consuming, but it is assumed that in database
environments where conflicts are rare, aborting and restarting will also be suffi-
ciently infrequent. Restarting is still tolerable compared to the overhead of locks
and timestamps.
The system keeps information for verification in the validation phase. During
execution, all updates are made to local copies. If serializability is not violated, a
transaction wishing to commit is allowed to commit and the database is updated
from the local copy; otherwise, the transaction is aborted and restarted later. The
optimistic protocol we are studying here uses timestamps and also maintains Write-
sets and Read-sets for transactions. The Write-set or Read-set for a transaction is
the set of data items the transaction writes or reads.
Let us study the three phases of an optimistic concurrency control technique:
Read Phase. Extends from the start of a transaction until just before it is ready to
commit. The transaction performs all the necessary read operations, stores values
in local variables, and stores values in local copies of data items kept in transaction
workspace.
Validation Phase. Extends from the end of the read phase to when the transaction
is allowed to commit or is aborted. The system checks to ensure that serializability
will not be violated if the transaction is allowed to commit. For a read-only trans-
action, the system verifies whether data values read are still the current values. If
so, the transaction is allowed to commit. If not, the transaction is aborted and
restarted. For an update transaction, the system determines whether the transaction
will leave the database in a consistent state and ensure serializability. If not, the
transaction is aborted and restarted.
Write Phase. Follows a successful verification in the validation phase. Updates are
made to the database from the local copies.
The system examines reads and writes of the transactions in the validation phase
using the following timestamps for each transaction T:
Start(T)
Start of execution of T
Validation(T)
Beginning of validation phase of T
Finish (T)
End of T, including write phase, if any
For a transaction T to pass the verification in the validation phase, one of the fol-
lowing must be true:
(1) Any transaction Tn with earlier timestamp must have ended before T started, that
is, Finish(Tn) < Start(T).
Search WWH ::




Custom Search