next up previous
Next: Variable Granularity Locking Up: No Title Previous: Multiversion Timestamp Ordering

Optimistic Concurrency Control

The previous schemes do incremental synchronization checks on each read/write-- by using explicit locks or timestamps. There are several disadvantages of incremental checks:

Incremental checks can be expensive, specially when they involve accessing slow secondary memory.

They are an unnecessary overhead when there are no conflicts (consider readonly transactions).

They can reduce concurrency unnecessarily (because locks are kept longer than necessary to avoid cascaded aborts) or lead to cascaded aborts (consider Figure 1).

Optimistic concurrency control divides a transaction into a read phase, a validation phase, and a writing phase. During (a) the read phase, a transaction reads database items, and performs writes on local buffers, with no checking taking place, (b) validation phase, the system does synchronization checking, and (c) the write phase, the local writes are made global. It assigns each transaction a unique timestamp at the end of its read phase. A transaction TI is validated if one of the following conditions can be established for all transactions TJ with later timestamps:

Transaction TI completes its write phase before transaction TJ begins its read phase.

Transaction TJ does not read any of the items written by TI and transaction TI finishes its write phase before transaction TJ begins its write phase.

Transaction TJ does not read or write any items written by TI.

Transactions are aborted when validation cannot be done. This approach works well when there are no conflicts (hence the term optimistic) but wastes work when there are conflicts. Aborting of transactions is a severe problem when the transactions are long and interactive, when manual/automatic merging is a better alternative.

Optimistic transactions also have the disadvantage that they do not allow increment sharing of transaction actions, thereby limiting concurrency. For example, they cannot support the schedule of Figure 1 as the read phase of T2 begins before the end of the write phase of T1. On the other hand, they do not lead to cascaded aborts.



next up previous
Next: Variable Granularity Locking Up: No Title Previous: Multiversion Timestamp Ordering



Prasun Dewan
Thu Mar 10 10:57:47 EST 2005