






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Transaction Processing
for Recoverability
We will synchronize Reads and Writes.
-^
We must therefore assume they’re atomic^ –
else we’d have to synchronize the finer-grainedoperations that implement Read and Write
-^
Read(x) - returns the current value of x in the DB
-^
Write(x, val) overwrites
all
of x (the
whole
page)
This assumption of atomic operations is whatallows us to abstract executions as sequences ofreads and writes (without loss of information).^ –
Otherwise, what would w
[x] rk
[x] mean?i
Also, commit (c
) and abort (ai
) are atomici
Transaction 1
Transaction N
Start, Commit, AbortRead(x), Write(x)
Data Manager Database
Transaction 2
Two operations conflict if their execution orderaffects their return values or the DB state.^ –
a read and write on the same data item conflict
two writes on the same data item conflict - two reads (on the same data item) do
not
conflict
Two histories are
equivalent
if they have the
same operations and conflicting operations arein the same order in both histories^ –
because only the relative order of conflictingoperations can affect the result of the histories
The following histories are equivalentH
1
= r
[x] r 1
[x] w 2
[x] c 1
1
w
[y] c 2
2
2
= r
[x] r 2
[x] w 1
[x] c 1
1
w
[y] c 2
2
3
= r
[x] r 2
[x] w 1
[y] c 2
2
w
[x] c 1
1
4
= r
[x] w 2
[y] c 2
2
r^1
[x] w
[x] c 1
1
But none of them are equivalent toH
5
= r
[x] w 1
[x] r 1
[x] c 2
1
w
[y] c 2
2
because r
[x] and w 2
[x] conflict and 1
r^2
[x] precedes w
[x] in H 1
1
, but 4
r^2
[x] follows w
[x] in H 1
6 = r
[x] r 1
[x] w 2
[x] r 1
[x] w 3
[y] w 2
[x] c 3
3
w
[y] c 1
1
c^2
is equivalent to a serial execution of T
2
1
7
= r
[x] w 2
[y] c 2
2
r^1
[x] w
[x] w 1
[y] c 1
1
r^3
[x] w
[x] c 3
3
Each conflict implies a constraint on any equivalentserial history:H
6 = r
[x] r 1
[x] w 2
[x] r 1
[x] w 3
[y] w 2
[x] c 3
3
w
[y] c 1
1
c^2
T
→ 2
T
1
T
→ 1
T
3
T
→ 2
T
1
T
→ 2
T
3
A serialization graph, SG(H), for history H tells theeffective execution order of transactions in H.
-^
Given history H, SG(H) is a directed graph whosenodes are the committed transactions and whoseedges are all T
→i
k^
such that at least one of T
’si
operations precedes and conflicts with at least oneof T
’s operationsk
6 = r
[x] r 1
[x] w 2
[x] r 1
[x] w 3
[y] w 2
[x] c 3
3
w
[y] c 1
1
c^2
SG(H
) = 6
T
→ 2
T
→ 1
T
3
Docsity.com