Timestamp-Based Protocols in Database

In general timestamp means a sequence of characters. In database to maintain serializability the transaction maintains ordering that is called timestamp ordering scheme. Let a unique timestamp is denoted by TS(Ti) where Ti is the transaction number. This timestamp TS(Ti) is assigned by the database system before new transaction Tj enters the database system. In timestamp protocol transaction maintain serial order. Let Q is the data item. So we denote two kind of timestamp such as 
W-timestamp(Q) that executed write(Q) successfully.
R-timestamp(Q) that executed read(Q) successfully.
The timestamp based protocol ensures read and write operations are executed in timestamp order. Timestamp protocol must maintain this following condition. 
Condition 1: Transaction Ti issues read(Q)
A. If TS(Ti)<W-timestamp(Q) then read operation is rejected and Ti is rolled back because Ti wants to write but it was already written.
B. If TS(Ti)=>W-timestamp then read operation is executed because read operation was not already written in the system.
Condition 2: Transaction Ti issues write(Q)
A. If TS(Ti)<R-timestamp is not possible because to produce data at first we need to read the data item then write. So the transaction Ti rolled back.
B. If TS(Ti)<W-timestamp is not possible because without read operation it produce an absolute value of Q and Ti is rolled back. 
C.  Otherwise the system executes the write operation.
If the transaction Ti is rolled back the system assigns it a new timestamp and restart the transaction.
To improve this content please make your comment or suggestion. 


Popular posts from this blog

How to show only month and year fields in android Date-picker?

How to construct a B+ tree with example

Homebrew uninstall