Information Technology Reference
In-Depth Information
4. After completing a partial rollback with action CŒP, all locks acquired after the
corresponding set-savepoint action SŒP are released.
5. All remaining locks are released after committing or completing a total rollback
of the transaction with action C .
Assume that a history H of transactions can be run on database D. We say that
H is possible under a locking protocol or permitted by the protocol or that the
transactions in H follow the protocol on D, if, when executing the history one action
at a time on D in the order the actions appear in H , all the locks requested according
to the protocol can be granted immediately without wait.
Example 6.2 Consider different histories of the transactions
T 1 D BR ŒxRŒyW Œ z C ,
T 2 D BR ŒyW ŒyC
run on a database that contains tuples with keys x, y,and z .
The history
H 1 D T 1 W BR Œx
RŒyW Œ z C
T 2 W BR ŒyW ŒyC
is possible under the read-write locking protocol, because all the locks requested for
the actions can be granted immediately:
1. For RŒx, a commit-duration S lock on x for T 1 .
2. For the first RŒy, a commit-duration S lock on y for T 2 .
3. For WŒy, a commit-duration X lock on y for T 2 .
4. After C , the locks held by T 2 on y are released.
5. For the second RŒy, a commit-duration S lock on y for T 1 .
6. For WΠz , a commit-duration X lock on z for T 1 .
7. After C , the locks held by T 1 on x, y and z are released.
We note that H 1 contains no isolation anomalies.
On the other hand, the history
H 2 D T 1 W BR Œx
RŒy
W Πz C
T 2 W
BR Œy
W ŒyC
is not possible under the read-write locking protocol, because of the S lock held by
T 1 on y while T 2 requests an X lock on y:
1. For RŒx, a commit-duration S lock on x for T 1 .
2. For the first RŒy, a commit-duration S lock on y for T 2 .
3. For the second RŒy, a commit-duration S lock on y for T 1 .
4. For WŒy, a commit-duration X lock on y for T 2 not granted.
Because of the lock held by T 1 on y, the exclusive lock requested by T 2 on y cannot
be granted immediately; so T 2 must wait for T 1 to commit and to release its locks,
thus preventing H 2 from occurring. We note that in H 2 , the read action RŒy by T 1 is
Search WWH ::




Custom Search