Information Technology Reference
In-Depth Information
no other transaction holds an incompatible lock on b, .b; r/ or .b;r;x/ where x is
any locked key in relation r .
However, this solution cannot be made as efficient as is necessary, especially
since we stated earlier that, for reasons of efficiency, the lock names must be short
hash values rather than the original variable-length keys. Thus, for efficiency, all
locks must be stored in a simple hash structure indexed by the lock names of data
items to be locked.
9.2
Intention Locks and Multi-Granular Locking
A practical solution to the problem of detecting lock incompatibilities between
data items of different granularities is to use new kinds of locks, called intention
locks . Such locks are of three different modes: IS (intention-shared), IX (intention-
exclusive), and SIX (shared + intention-exclusive).
An intention-shared lock or an IS lock for transaction T on a larger-granule data
item x means that T is allowed to acquire S locks on the smaller-granule data
items contained in x (and additional IS locks, if the data items in x are further
subdivided into smaller data items). When T wants to read only some of the data
items contained in x,itIS-locksx and then S-locks those contained data items it
actually reads.
An intention-exclusive lock or an IX lock for transaction T on a larger-granule
data item x means that T may acquire X and S locks on the smaller-granule data
items contained in x (and additional IX, IS, and SIX locks, if the data items in x are
further subdivided). When T wants to update only some of the data items contained
in x,itIX-locksx and then X-locks those contained data items it actually updates.
A shared and intention-exclusive lock or a SIX lock is a combination of an S lock
and an IX lock. A SIX lock for transaction T on data item x means that T is allowed
to read all of x (under the protection of the S lock included in the SIX lock) and
to acquire X and IX locks on (and hence to update) smaller-granule data items
contained in x (by the IX lock included in SIX).
An S lock on a larger-granule data item x implicitly locks in S mode all the
smaller-granule data items contained in x, recursively down into the smallest-
granule data items, without the need to lock them explicitly. Likewise, an X lock
on x implicitly X-locks all smaller-granule data items contained in it. If a transaction
holds an implicit S lock (resp. X lock) on x, it must not request an explicit S lock
(resp. X lock) on x.
An X lock is incompatible with an IS lock and with an IX lock. Thus, if
transaction T 1 holds an X lock on a larger-granule data item x,thennoother
transaction T 2 can simultaneously hold an S lock (resp. an X lock) on any data
item contained in x, because then T 2 would have to hold an IS lock (resp. IX lock)
on x. Accordingly, T 2 is prevented from reading or updating data items contained in
a data item being updated by T 1 .
Search WWH ::




Custom Search