Definitionintro
Schedule (transaction history)
Also called transaction schedule, history of transactions.
An interleaving of the read, write, commit and abort actions of several transactions that keeps the order within each transaction.
A schedule (also called a history) is a sequence of the read, write, commit and abort actions of several transactions that holds every action once and keeps the order of the actions inside each transaction. It is the object that a database scheduler produces and that the correctness classes judge: serializability asks whether the schedule has the effect of some serial order, and the recovery classes (recoverable, cascadeless and strict schedules) ask whether aborts can be handled safely. The model keeps only which item each action touches and whether it reads or writes; the values and the program logic are abstracted away.
Definition
Items and actions. Fix a set of data items . For a transaction index , an action is one of (a read of ), (a write of ), (commit) and (abort). This is the page model or read-write model: returns the current value of , and sets a new value that may depend on everything that has read before.
Transaction. A transaction is a finite sequence of reads and writes of , followed by at most one terminal action or . Bernstein, Hadzilacos and Goodman allow a partial order inside a transaction instead of a sequence; every definition below carries over if "the order of " means that partial order.
Schedule. Let . A complete schedule (history) over is a sequence of actions such that:
- every action of every occurs in exactly once, and has no other actions;
- for all actions of the same : if comes before in , then comes before in ;
- every has a terminal action.
A schedule is a prefix of a complete schedule. So in a schedule a transaction may still be active (no terminal action yet), and no action of follows or . We write when comes before in . Weikum and Vossen use "history" for a complete schedule and "schedule" for a prefix; many texts use the two words as synonyms.
Derived notions. For a schedule :
- is committed in if , aborted if , and active otherwise.
- The committed projection is the subsequence of that keeps exactly the actions of the committed transactions. The serializability classes are defined on .
- is serial if, for every two transactions , all actions of come before all actions of or the other way round.
- Two actions conflict if they belong to different transactions, touch the same item, and at least one of them is a write.
- reads from in () if , , and every with has . An abort restores the value that its transaction overwrote, so a write of an aborted transaction stops counting from the moment of the abort. The recovery classes are defined with this relation.
Counting. If has actions and , then the number of complete schedules over is the multinomial coefficient
and exactly of them are serial. Proof. Map a schedule to the word where is the index of the transaction of the -th action. Condition 2 means that the actions of fill the positions with in their own order, so the word fixes the schedule. Every word with letters arises. The number of such words is the multinomial coefficient. A serial schedule is fixed by the order of its blocks, and different orders give different schedules, so there are of them.
Examples and non-examples
All schedules of two small transactions. Let and , two transactions that each add 1 to . There are complete schedules. Two are serial. Eight are conflict serializable: the two serial ones, and six in which one transaction finishes its read and write of before the other reads , but commits later. In the other twelve, both transactions read before either one writes it, so one of the two updates is lost.
A schedule with an active transaction. is a schedule but not a complete one: is active. Its committed projection is .
Reads-from across an abort. In , the read comes after and before , so reads from , and it has seen a value that the abort later erases. The committed projection is , and in the same read seems to read from . So is serial, but is not recoverable: committed after reading from a transaction that aborted. Correctness needs both kinds of condition.
Non-examples.
- With , the sequence is not a schedule over , because it breaks condition 2: the program of reads before it writes.
- is not a schedule: an action of follows its terminal action.
- is not a schedule: a transaction ends at most once.
- over is not a schedule over : an action occurs twice. (It is a schedule over a different transaction that reads twice.)
Related definitions
- Serializability, conflict serializability and view serializability are properties of . They say whether the committed work has the effect of a serial order.
- Recoverable, cascadeless and strict schedules are properties of the whole of , with its aborts. They say whether an abort can be handled without undoing a commit, without forcing other aborts, or by restoring before images. They are independent of serializability, as the reads-from example shows.
- Prefix closure. A class of schedules is prefix closed if every prefix of a member is a member. A scheduler that decides online must aim at such a class, since it sees only a prefix. The recovery classes and conflict serializability of are prefix closed; view serializability is not. For example, is not view serializable (the last write of asks for before , the last write of for the opposite), but it is a prefix of the same schedule followed by , which is view equivalent to .
- Concurrency control is the problem of building a scheduler: a program that receives actions one by one and outputs a schedule in a chosen class, by running, delaying or rejecting each action. Isolation levels are weaker classes that a scheduler may aim at instead.
- Multiversion schedules add a version function that says which write each read sees. They are judged by multiversion serializability.
- Histories in distributed computing. A history for linearizability is a sequence of invocation and response events of operations on shared objects, with real time. It is a different model: there are no transactions over many items, and the real-time order matters.
References
- Philip A. Bernstein, Vassos Hadzilacos and Nathan Goodman, Concurrency Control and Recovery in Database Systems, Addison-Wesley, 1987, Chapter 1 (transactions, recoverability) and Chapter 2 (histories as partial orders, committed projections, the reads-from relation)
- Gerhard Weikum and Gottfried Vossen, Transactional Information Systems, Morgan Kaufmann, 2001, Chapter 3 (the page model, transactions, histories and schedules, committed projection)
- K. P. Eswaran, J. N. Gray, R. A. Lorie and I. L. Traiger, The notions of consistency and predicate locks in a database system, Communications of the ACM 19(11), 1976, pages 624 to 633, the model of transactions as sequences of actions and of schedules as their interleavings
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag W8A3HT Edit this page History Report an error Markdown