In the fields of and transaction processing (transaction management), a schedule (or history) of a system is an abstract model to describe the order of executions in a set of transactions running in the system. Often it is a list of operations (actions) ordered by time, performed by a set of transactions that are executed together in the system. If the order in time between certain operations is not determined by the system, then a partial order is used. Examples of such operations are requesting a read operation, reading, writing, aborting, committing, requesting a lock, locking, etc. Often, only a subset of the transaction operation types are included in a schedule.
Schedules are fundamental concepts in database concurrency control theory. In practice, most general purpose database systems employ conflict-serializable and strict recoverable schedules.
+D !T1 !T2 !T3 | ||
R(X) | ||
W(X) | ||
Com. | ||
R(Y) | ||
W(Y) | ||
Com. | ||
R(Z) | ||
W(Z) | ||
Com. |
The schedule D above can be represented as list in the following way:
D = R1(X) W1(X) Com1 R2(Y) W2(Y) Com2 R3(Z) W3(Z) Com3
Operations of transactions in a schedule can interleave (i.e., transactions can be executed concurrently), but time orders between operations in each transaction must remain unchanged. The schedule is in partial order when the operations of transactions in a schedule interleave (i.e., when the schedule is conflict-serializable but not serial). The schedule is in partial order when the operations of transactions in a schedule do not interleave (i.e., when the schedule is serial).
Schedule D is an example of a serial schedule:
+D !T1 !T2 !T3 | ||
R(X) | ||
W(X) | ||
Com. | ||
R(Y) | ||
W(Y) | ||
Com. | ||
R(Z) | ||
W(Z) | ||
Com. |
In schedule E, the order in which the actions of the transactions are executed is not the same as in D, but in the end, E gives the same result as D.
+E !T1 !T2 !T3 | ||
R(X) | ||
R(Y) | ||
R(Z) | ||
W(X) | ||
W(Y) | ||
W(Z) | ||
Com. | Com. | Com. |
If any specific order between some transactions is requested by an application, then it is enforced independently of the underlying serializability mechanisms. These mechanisms are typically indifferent to any specific order, and generate some unpredictable partial order that is typically compatible with multiple serial orders of these transactions.
The following set of actions is conflicting:
While the following sets of actions are not conflicting:
The conflict is materialized if the requested conflicting operation is actually executed: in many cases a requested/issued conflicting operation by a transaction is delayed and even never executed, typically by a lock on the operation's object, held by another transaction, or when writing to a transaction's temporary private workspace and materializing, copying to the database itself, upon commit; as long as a requested/issued conflicting operation is not executed upon the database itself, the conflict is non-materialized; non-materialized conflicts are not represented by an edge in the precedence graph.
Equivalently, two schedules are said to be conflict equivalent if and only if one can be transformed to another by swapping pairs of non-conflicting adjacent operations with different transactions.
Equivalently, a schedule is conflict-serializable if and only if its precedence graph is acyclic when only committed transactions are considered. Note that if the graph is defined to also include uncommitted transactions, then cycles involving uncommitted transactions may occur without conflict serializability violation.
The schedule K is conflict-equivalent to the serial schedule
In the example below, the schedules S1 and S2 are view-equivalent, but neither S1 nor S2 are view-equivalent to the schedule S3.
Notice that the above example (which is the same as the example in the discussion of conflict-serializable) is both view-serializable and conflict-serializable at the same time. There are however view-serializable schedules that are not conflict-serializable: those schedules with a transaction performing a blind write:
The above example is not conflict-serializable, but it is view-serializable since it has a view-equivalent serial schedule
Since determining whether a schedule is view-serializable is NP-complete, view-serializability has little practical interest.
Schedule J is unrecoverable because T2 committed before T1 despite previously reading the value written by T1. Because T1 aborted after T2 committed, the value read by T2 is wrong. Because a transaction cannot be rolled-back after it commits, the schedule is unrecoverable.
The following examples are the same as the ones in the discussion on recoverable:
In this example, although F2 is recoverable, it does not avoid
cascading aborts. It can be seen that if T1 aborts, T2 will have to
be aborted too in order to maintain the correctness of the schedule
as T2 has already read the uncommitted value written by T1.
The following is a recoverable schedule which avoids cascading abort. Note, however, that the update of A by T1 is always lost (since T1 is aborted).
Note that this Schedule would not be serializable if T1 would be committed.
Cascading aborts avoidance is sufficient but not necessary for a schedule to be recoverable.
Any strict schedule is cascade-less, but not the converse. Strictness allows efficient recovery of databases from failure.
The Venn diagram (below) illustrates the above clauses graphically.
Conflict serializability can be enforced by restarting any transaction within the cycle in the precedence graph, or by implementing two-phase locking, timestamp ordering, or serializable snapshot isolation.Michael J. Cahill, Uwe Röhm, Alan D. Fekete (2008): "Serializable isolation for snapshot databases", Proceedings of the 2008 ACM SIGMOD international conference on Management of data, pp. 729-738, Vancouver, Canada, June 2008, (SIGMOD 2008 best paper award)
+K
!T1
!T2 R(A) R(A) W(B) Com. W(A) Com.
View equivalence
Additionally, two view-equivalent schedules must involve the same set of transactions such that each transaction has the same actions in the same order.
The conditions for S3 to be view-equivalent to S1 and S2 were not satisfied at the corresponding superscripts for the following reasons:
R(A) R(A) R(A) W(A) W(A) W(A) R(B) (1) R(A) R(A) W(B) W(A) W(A) Com. R(B) (1) R(B) (1) R(A) W(B) W(B) W(A) Com. R(B) (2) R(B) (2) R(B) (2) W(B) (3) W(B) (3) W(B) (3) Com. Com. Com. Com.
To quickly analyze whether two schedules are view-equivalent, write both schedules as a list with each action's subscript representing which view-equivalence condition they match. The schedules are view equivalent if and only if all the actions have the same subscript (or lack thereof) in both schedules:
View-serializable
+G
!T1
!T2 R(A) R(A) W(B) +H
!T1
!T2
!T3 R(A) W(A) Com. W(A) Com. W(A) Com.
Recoverable
These schedules are recoverable. The schedule F is recoverable because T1 commits before T2, that makes the value read by T2 correct. Then T2 can commit itself. In the F2 schedule, if T1 aborted, T2 has to abort because the value of A it read is incorrect. In both cases, the database is left in a consistent state.
R(A) R(A) R(A) W(A) W(A) W(A) R(A) R(A) R(A) W(A) W(A) W(A) Com. Abort Com. Com. Abort Abort
Cascadeless
R(A) R(A) W(A) W(A) R(A) R(A) W(A) W(A) Com. Abort Com. Abort +F3
!T1
!T2 R(A) R(A) W(A) W(A) Abort Commit
Strict
Serializability class relationships
See also
|
|