Let us show this scheme here with the help of the following examples:
Consider the set for transaction T1 and T2.
Reads the read set (T2). Let say variables X and Y and
performs updating of local values
Reads the read set (T1) lets
say variable X and Y and performs updating of local values
Validate the values of (T1)
Validate the values of (T2)
Write the updated values in
the database and commit
Write the updated values in the
database and commit
In this given instance both T1 and T2 get committed. Please note that Read set of T1 and Read Set of T2 are both disjoint, also the Write sets are also disjoint and therefore no concurrency related problem can happen.
Validate (D,A) finds OK
Write (D,A), COMMIT
Value changed by T3
In this scheme both T1 and T2 get aborted as they fail during validate phase whereas only T3 is committed. Optimistic concurrency control performs its checking at the transaction commits point in a validation phase. The serialization order is defined by the time of transaction validation phase.