Definitions from Transaction Processing

advertisement
CSC 8490
Some definitions, facts and practice on transaction processing
Characterizing a (complete) schedule S based on recoverability
 S is recoverable if no transaction T in S commits until all transactions that
T has “read from” have committed. No committed transaction ever needs
to be rolled back.
 S is cascadeless if every T in S reads items only from committed
transactions. No item read will be discarded.
 S is strict if no T in S can either read or write an item X until the last
transaction that wrote X has either committed or aborted.
Conclude: strict => cascadeless => recoverable
Characterizing a schedule S based on serializability
 S is serializable if it’s equivalent to a serial schedule.
 S is conflict serializable if it’s conflict equivalent to a serial schedule S’.
This means that any two operations in S that conflict (are in different
transactions, include at least one write, and access the same item) are in
the same order in S as they are in S’.
 S is view serializable if it’s view equivalent to a serial schedule S’. This
means that for any transactions T1 and T2 in S,
o T1 reads from T2 in S if and only if it reads from T2 in S’.
o T1 reads the original value of X in S if and only if it also does so in
S’.
o T1 writes the final value of X in S if and only if it also does so in S’
Conclude: conflict serializable => view serializable => result serializable
Another fun fact: A partial converse is that a schedule that is view serializable
and has no blind writes is conflict serializable.
Characterizing a schedule S based on 2-phase locking on its transactions T
 T satisfies (basic) 2-phase locking (2PL) if, once T unlocks any item, it
can no longer lock any item.
 T satisfies strict 2PL if it satisfies 2PL, and, further, it holds all its X-locks
till termination.
 T satisfies rigorous 2PL if it holds all its locks till termination.
Conclude: rigorous 2PL => strict 2PL => 2PL.
CSC 8490
Some practice on transaction processing
1) Classify as non-recoverable, only recoverable, only cascadeless, or strict:
a) r1(X); w1(X); r2(X); r1(Y); w2(X); w1(Y); C1; C2;
b) r1(X); w1(X); r2(X); r1(Y); w2(X); w1(Y); C2; C1;
c) r1(X); r2(X); w2(X); w1(X); r1(Y); C2; w1(Y); C1;
d) r1(X); r2(X); w2(X); C2; w1(X); r1(Y); w1(Y); C1;
2) Classify as conflict serializable, only view serializable, or neither:
a) r3(X); r2(X); w3(X); r1(X); w1(X);
b) r3(X); r2(X); r1(X); w3(X); w1(X);
c) r1(X); w2(X); w1(X); w3(X);
d) r2(Y); w1(Y); w1(X); w2(X); w3(X);
3) For those same schedules as the last exercise, tell whether (basic) 2PL could
be in effect. If so, provide a time-line like Fig. 22.3 in our text (E&N6).
Download