104k views
1 vote
1. Consider a database with object X and Y and assume that there are two transactions T1 and T2. Transaction T1 reads objects X and Y and then writes object X. Transaction T2 reads objects X and Y and writes objects X and Y. (a) Give an example schedule with actions of transaction T1 and T2 on objects X and Y that results in a write-read conflict. (b) Give an example schedule with actions of transaction T1 and T2 on objects X and Y that results in a read-write conflict. (c) Give an example schedule with actions of transaction T1 and T2 on objects X and Y that results in a write-write conflict. (d) For each of the schedules, show that strict 2PL disallows the schedule.

User Aalex Gabi
by
4.9k points

1 Answer

1 vote

Answer:

See explaination

Step-by-step explanation:

1. The following schedule results in a write-read conflict:

T2:R(X), T2:R(Y), T2:W(X), T1:R(X) ...

T1:R(X) is a dirty read here.

2. The following schedule results in a read-write conflict:

T2:R(X), T2:R(Y), T1:R(X), T1:R(Y), T1:W(X) ...

Now, T2 will get an unrepeatable read on X.

3. The following schedule results in a write-write conflict:

T2:R(X), T2:R(Y), T1:R(X), T1:R(Y), T1:W(X), T2:W(X) ...

Now, T2 has overwritten uncommitted data.

Below history will show that T1 and T2 preserves the consistency requirement of the database

T1 T2:R1X, R1Y, W1X, c1, R2X, R2Y, W2X, W2Y, c2

T2 T1:R2X, R2Y, W2X, W2Y, c2,R1X, R1Y, W1X, c1

b)

To eliminate both undo and redo, all of T’s updates must be recorded in the stable database in a single atomic operation when T commits

We can implement this strategy using Shadowing and Stable database techniques.

User Saamer
by
4.6k points