Concurrency Control by Validation Swathi Vegesna
At a Glance Introduction Validation based scheduling Validation based Scheduler Expected exceptions Validation rules Example Comparisons Summary References
Introduction What is optimistic concurrency control? Timestamp- based scheduling and Validation-based scheduling
Validation based scheduling Scheduler keep a record of what the active transactions are doing. Executes in 3 phases Read Validate Write
Validation based Scheduler Contains an assumed serial order of transactions. Maintains three sets: START( ): set of T’s started but not completed validation. VAL( ): set of T’s validated but not finished the writing phase. FIN( ): set of T’s that have finished.
Expected exceptions 1. Suppose there is a transaction U, such that: U is in VAL or FIN; that is, U has validated, FIN(U)>START(T); that is, U did not finish before T started RS(T) ∩WS(T) ≠φ; let it contain database element X. 2. Suppose there is transaction U, such that: U is in VAL; U has successfully validated. FIN(U)>VAL(T); U did not finish before T entered its validation phase. WS(T) ∩ WS(U) ≠φ; let x be in both write sets.
Validation rules Check that RS(T) ∩ WS(U)= φ for any previously validated U that did not finish before T has started ie FIN(U)>START(T). Check that WS(T) ∩ WS(U)= φ for any previously validated U that did not finish before T is validated ie FIN(U)>VAL(T)
Example
Solution Validation of U: Nothing to check Validation of T: WS(U) ∩ RS(T)= {D} ∩{A,B}=φ WS(U) ∩ WS(T)= {D}∩ {A,C}=φ Validation of R: RS(V) ∩ WS(T)= {B}∩{A,C}=φ WS(V) ∩ WS(T)={D,E}∩ {A,C}=φ RS(V) ∩ WS(U)={B} ∩{D}=φ Validation of W: RS(W) ∩ WS(T)= {A,D}∩{A,C}={A} WS(W) ∩ WS(V)= {A,D}∩{D,E}={D} WS(W) ∩ WS(V)= {A,C}∩{D,E}=φ (W is not validated)
Comparison Concurrency control Mechanisms Storage Utilization Delays Locks Space in the lock table is proportional to the number of database elements locked. Delays transactions but avoids rollbacks Timestamps Space is needed for read and write times with every database element, neither or not it is currently accessed. Do not delay the transactions but cause them to rollback unless Interface is low Validation Space is used for timestamps and read or write sets for each currently active transaction, plus a few more transactions that finished after some currently active transaction began. Do not delay the transactions but cause them to rollback unless interface is low
Summary Concurrency control by validation The three phases Validation Rules Comparison
References Database Systems: The Complete Book
Thank you