Docsity

Serializability and Conflict Resolution in Database Systems, Exercises of Transaction Processing for E Commerce

Toggle sidebar
bg1
Assignment 2 - Solution
1. w0[x,y,z] c0 r1[x] r2[y] w2[y] r3[z] w3[z] r2[z] w2[y] w1[z] w1[y] c1 c2 c3
a. An equivalent serial history must preserve the order of conflicting
operations. So, which operations conflict? We’ll use to mean
“precedes and conflicts with”.
w0[x,y,z] all other reads and writes
r2[y] and both w2[y]’s w1[y]
w3[z] r2[z]
r3[x] and w3[z] w1[z]
So, the only equivalent serial history has transactions in the order 0-3-2-1
b. Since w3[z] r2[z] and c2 c3 the history is not recoverable. Hence, it
doesn’t avoid cascading aborts and isn’t strict. There are two other
violations of strictness: w3[z] < w1[z] < c3 and w2[y] < w1[y] < c2.
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Serializability and Conflict Resolution in Database Systems and more Exercises Transaction Processing for E Commerce in PDF only on Docsity!

Assignment 2 - Solution

1. w 0 [x,y,z] c 0 r 1 [x] r 2 [y] w 2 [y] r 3 [z] w 3 [z] r 2 [z] w 2 [y] w 1 [z] w 1 [y] c 1 c 2 c 3

a. An equivalent serial history must preserve the order of conflicting operations. So, which operations conflict? We’ll use  to mean “precedes and conflicts with”.

w 0 [x,y,z]  all other reads and writes r 2 [y] and both w 2 [y]’s  w 1 [y] w 3 [z]  r 2 [z] r 3 [x] and w 3 [z]  w 1 [z] So, the only equivalent serial history has transactions in the order 0- 3 - 2 - 1

b. Since w 3 [z]  r 2 [z] and c 2  c 3 the history is not recoverable. Hence, it doesn’t avoid cascading aborts and isn’t strict. There are two other violations of strictness: w 3 [z] < w 1 [z] < c 3 and w 2 [y] < w 1 [y] < c 2.

  1. w 0 [x,y,z] c 0 r 1 [x] r 2 [y] w 2 [y] r 3 [z] r 2 [z] w 2 [y] w 1 [z] w 1 [y] c 1 c 2 c 3

(same as (1), except delete w 3 [z] )

a. We no longer have w 3 [z]  r 2 [z]. So the order of T 3 relative to T 2 is

unconstrained. Therefore, the history is now equivalent to a serial history with transactions in the order 0- 3 - 2 - 1 or 0- 2 - 3 - 1.

b. The history is now recoverable and avoids cascading aborts. But it still isn’t strict because w 3 [z] < w 1 [z] < c 3 and w 2 [y]  w 1 [y]  c

  1. w 0 [x,y,z] c 0 r 1 [x] r 2 [y] w 2 [x] r 3 [z] w 3 [z] r 2 [z] w 2 [y] w 1 [z] w 1 [y] c 1 c 2 c 3

(same as (1), except the first w 2 [y] becomes w 2 [x])

a. Now we have r 1 [x]  w 2 [x] and w 2 [y]  w 1 [y] forming a cycle, so there is no equivalent serial history.

b. w 3 [z]  r 2 [z] and c 2  c 3 is unchanged from (1), so the history is not recoverable since T 2 reads uncommitted data.

  1. w 0 [x,y,z] c 0 r 1 [x] r 2 [y] w 2 [y] r 3 [z] w 3 [z] r 2 [z] w 2 [y] c 2 w 1 [z] w 1 [y] c 1 c 3

(same as (1), except c 2 is moved before w 1 [z])

a. This has no effect on serializability

b. It is tempting to think that this helps strictness, since we now have w 3 [z] < c 3 < w 1 [z] and w 2 [y] < c 2 < w 1 [y]. But strictness implies avoidance of cascading aborts, which implies recoverability. And we still have the same old violation of recoverability: T 2 still reads uncommitted data (z) from T 3. So the execution isn’t strict.