Database Reference
In-Depth Information
Timestamps The DBMS assigns a unique identifier to each transaction as soon
as it is submitted for execution. This identifier is used as the timestamp for that
transaction to be used for ordering transaction executions. If transaction T2 is sub-
mitted after transaction T1, Timestamp(T1) < Timestamp(T2).
DBMSs use two common methods for assigning timestamps:
Use a logical counter that is incremented each time its value is assigned to a
transaction when the transaction arrives at the system. The logical counter is
reset periodically to an initial value.
Use the current date and time value of the system while making sure that no
two transactions are given the same timestamp value.
Besides timestamps for transactions, timestamp ordering also needs timestamps
for data items. Two timestamp values are associated with a data item D as indicated
below:
Read-timestamp(D)—
Indicates the timestamp of the largest timestamp of the
transactions that successfully read D, that is, the time-
stamp of the youngest transaction that read D success-
fully.
Write-timestamp(D)—
Indicates the timestamp of the largest timestamp of
the transactions that successfully wrote D, that is, the
timestamp of the youngest transaction that wrote D
successfully.
Read- and write-timestamps for data item D are updated whenever newer trans-
actions read or write D, respectively.
Basic Timestamp Ordering Recall transaction executions using 2PL. The
protocol makes a schedule serializable by making it equivalent to some serial
schedule. The equivalent serial schedule is not necessarily representative of the
order in which transactions entered the system. However, in the case of
timestamp ordering, the equivalent schedule preserves the specific order of the
transactions.
The timestamp ordering protocol examines each read and write operation to
ensure that they are executed in strict timestamp order of the transactions. Here is
how the protocol works for a transaction T in relation to a data item D:
(1) T issues read(D)
(a) Timestamp(T) < Write-timestamp(D)
T asks to read D that has already been updated by a younger or later trans-
action. This means that an earlier transaction T is asking to read D that has
updated by a later transaction. T is too late to read the previous outdated value.
Values of any other data items acquired by T are likely to be incompatible with
the value of D.
Reject read operation. Abort T and restart it with a new timestamp.
(b) Timestamp(T) > = Write-timestamp(D)
T asks to read D that has been updated not by a later transaction.
Search WWH ::




Custom Search