Multi-version Concurrency Control (cont)
WTS = timestamp of last writer; RTS = timestamp of last reader
Chained tuple versions: tupoldest → tupolder → tupnewest
When a reader Ti is accessing the database
- ignore any data item created after Ti started (WTS > TS(Ti))
- use only newest version V satisfying
WTS(V) < TS(Ti)
When a writer Tj attempts to change a data item
- find newest version V satisfying WTS(V) < TS(Tj)
- if RTS(V) ≤ TS(Tj), create new version of data item
- if RTS(V) > TS(Tj), reject the write and abort Tj
|