(1) Transaction T issues a read(x)
(a) Transaction T asks to read an item (x) that has already been updated by a younger
(later) transaction, that is ts(T) < write_timestamp(x). This means that an earlier
transaction is trying to read a value of an item that has been updated by a later
transaction. The earlier transaction is too late to read the previous outdated value,
and any other values it has acquired are likely to be inconsistent with the updated
value of the data item. In this situation, transaction T must be aborted and
restarted with a new (later) timestamp.
(b) Otherwise, ts(T) ≥ write_timestamp(x), and the read operation can proceed. We
set read_timestamp(x) = max(ts(T), read_timestamp(x)).
(2) Transaction T issues a write( x)
(a) Transaction T asks to write an item ( x) whose value has already been read by a
younger transaction, that is ts(T) < read_timestamp( x). This means that a later trans-action is already using the current value of the item and it would be an error to
update it now. This occurs when a transaction is late in doing a write and a younger
transaction has already read the old value or written a new one. In this case, the
only solution is to roll back transaction T and restart it using a later timestamp.
(b) Transaction T asks to write an item ( x) whose value has already been written by a
younger transaction, that is ts(T) < write_timestamp(x). This means that trans-action T is attempting to write an obsolete value of data item x. Transaction T
should be rolled back and restarted using a later timestamp.
(c) Otherwise, the write operation can proceed. We set write_timestamp( x) = ts(T).
This scheme, called basic timestamp ordering, guarantees that transactions are conflict
serializable, and the results are equivalent to a serial schedule in which the transactions
are executed in chronological order of the timestamps. In other words, the results will be
as if all of transaction 1 were executed, then all of transaction 2, and so on, with no inter-leaving. However, basic timestamp ordering does not guarantee recoverable schedules.
Before we show how these rules can be used to generate a schedule using timestamping,
we first examine a slight variation to this protocol that provides greater concurrency.