Information Technology Reference
In-Depth Information
commit-duration S locks prevent unrepeatable reads. These observations clearly
hold true if “commit duration” is interpreted in its strictest sense, meaning a lock
that, once granted, is held until the transaction has committed or completed its total
rollback.
Dirty writes and dirty reads are also prevented if “commit duration” has its
relaxed meaning that permits a commit-duration lock to be released when a data
item updated by a transaction is returned to its committed state in a partial rollback
of the transaction. This clearly is the case when the X lock has been granted for a
write action that is included in the rolled-back action sequence. We also note that
the S lock acquired for a read action that is not included in a rolled-back action
sequence is kept until the transaction has committed or completed its total rollback.
We leave as an exercise the proving of the converse result that the absence of the
anomalies implies that the history is permitted by the read-write locking protocol. t
An important property of the read-write locking protocol (also shared by all
the other locking protocols presented in this topic) is that an aborted transaction
or a transaction doing a partial rollback does not need to acquire any new locks
for the backward-rolling actions. An undo action W 1 Œx; u ; v is protected by the
commit-duration X lock on key x acquired by the transaction for the corresponding
forward-rolling action WŒx; u ; v . Thus, no deadlock (see Sect. 6.5 ) can arise that
could prevent a backward-rolling transaction from completing its rollback.
In the traditional literature on concurrency control, the read-write locking
protocol appears in a simplified form in which partial rollbacks (if they appear in
the transaction model) involve no lock releases. That is, all locks are held until the
transaction has committed or completed its total rollback. That protocol is called the
strict two-phase locking protocol ,or strict 2PL for short.
There is also a locking protocol called just two-phase locking protocol or 2PL ,
that is, without the “strict” attribute. In that locking protocol, a transaction must
acquire an S lock on x for the read action RŒx andanXlockonx for the write
action WŒx, but the locks do not need to be commit duration, as long as T does not
acquire any new locks after releasing any one lock. Thus, the locking operations of
a transaction following the 2PL protocol can be divided into two phases: (1) a phase
where the transaction acquires new locks, increasing the amount of locks held by the
transaction, and (2) a phase where all the locks are released. With the 2PL protocol,
conflict-serializability is guaranteed for read-write-model transactions, but, because
locks can be released before the commit, isolation anomalies are not prevented, so
the protocol is only of theoretical interest.
6.4
Key-Range Locking
The simple locking protocol for the read-write model cannot be directly applied to
the key-range model when full isolation is required. This is because for full isolation,
also phantom dirty reads and phantom unrepeatable reads must be prevented. But if
Search WWH ::




Custom Search