Concurrency Control
Concurrency Control
Atomicity - Either the effects of all or none of its operations remain ("all or
nothing" semantics) when a transaction is completed
(committed or aborted respectively). In other words, to the outside world a
committed transaction appears (by its effects on the database) to be indivisible
(atomic), and an aborted transaction does not affect the database at all. Either
all the operations are done or none of them are.
Consistency - Every transaction must leave the database in a consistent
(correct) state, i.e., maintain the predetermined integrity rules of the database
(constraints upon and among the database's objects). A transaction must
transform a database from one consistent state to another consistent state
(however, it is the responsibility of the transaction's programmer to make sure
that the transaction itself is correct, i.e., performs correctly what it intends to
perform (from the application's point of view) while the predefined integrity
rules are enforced by the DBMS). Thus since a database can be normally
changed only by transactions, all the database's states are consistent.
Isolation - Transactions cannot interfere with each other (as an end result of
their executions). Moreover, usually (depending on concurrency control
method) the effects of an incomplete transaction are not even visible to another
transaction. Providing isolation is the main goal of concurrency control.
Durability - Effects of successful (committed) transactions must persist
through crashes (typically by recording the transaction's effects and its commit
event in a non-volatile memory).
The concept of atomic transaction has been extended during the years to what has
become Business transactions which actually implement types of Workflow and
are not atomic. However also such enhanced transactions typically utilize atomic
transactions as components.
Conflict Graphs
Another method is to create conflict graphs. For this transaction classes are
defined. A transaction class contains two set of data items called read set and
write set. A transaction belongs to a particular class if the transaction’s read set is
a subset of the class’ read set and the transaction’s write set is a subset of the
class’ write set. In the read phase, each transaction issues its read requests for the
data items in its read set. In the write phase, each transaction issues its write
requests.
A conflict graph is created for the classes to which active transactions belong.
This contains a set of vertical, horizontal, and diagonal edges. A vertical edge
connects two nodes within a class and denotes conflicts within the class. A
horizontal edge connects two nodes across two classes and denotes a write-write
conflict among different classes. A diagonal edge connects two nodes across two
classes and denotes a write-read or a read-write conflict among two classes.
The conflict graphs are analyzed to ascertain whether two transactions within the
same class or across two different classes can be run in parallel.