|
@@ -25,7 +25,7 @@ Given these two transactions:
|
|
|
WHERE client = 'Smith'
|
|
|
|
|
|
#### Execution with lost UPDATE
|
|
|
-As the name states, one o two changes to the data is lost.
|
|
|
+As the name states, one or more changes to the data are lost.
|
|
|
The error is produced by:
|
|
|
- R1 R2 W1 W2
|
|
|
- R1 R2 W2 W1
|
|
@@ -94,7 +94,7 @@ $r_2,w_2\in T_2$
|
|
|
- __Scheduler__: component that accepts or rejects the operations requested by the transactions
|
|
|
- __Serial schedule__: the actions of each transaction occur in contiguous sequences
|
|
|
- __Serializable schedule__: Produces the same results as some serial schedule on the same transactions (by *schedule equivalence*)
|
|
|
-- The class of acceptable schedules produced by a scheduler depends on the cost of equivalence checking (???)
|
|
|
+- The class of acceptable schedules produced by a scheduler depends on the cost of equivalence checking, because scheduling must happen in real-time and the more is optimized my sheduling the more computational power I will need to obtain it.
|
|
|
### CSR and VSR
|
|
|
$CSR\subset VSR$
|
|
|
#### View-serializability
|
|
@@ -110,28 +110,74 @@ A schedule is __view-serializable__ if it is equivalent to a serial schedule.
|
|
|
__VSR__ is the set of *view-serializable* schedules.
|
|
|
|
|
|
#### VSR
|
|
|
-defines the schedule which are:
|
|
|
+defines the schedules which are:
|
|
|
- serializable
|
|
|
-- anomaly-free
|
|
|
+- anomaly-free
|
|
|
But is vast and costly to evaluate
|
|
|
#### CSR
|
|
|
Is a subset of VSR solutions, used because it contains costs.
|
|
|
|
|
|
##### Example of View-serializability
|
|
|
```
|
|
|
-S3: w0(x) r2(x) r2(x) w2(x) w2(z)
|
|
|
+S3: w0(x) r2(x) r1(x) w2(x) w2(z)
|
|
|
S4: w0(X) r1(x) r2(x) w2(x) w2(z)
|
|
|
-S5: w0(x) r2(x) r2(x) w2(x) w2(z) //incorrect
|
|
|
-S6: w0(X) r1(x) r2(x) w2(x) w2(z) //incorrect
|
|
|
+S5: w0(x) r1(x) w1(x) r2(x) w1(z)
|
|
|
+S6: w0(x) r1(x) w1(x) w1(z) r2(z)
|
|
|
```
|
|
|
+In this example S3 is view serializable to S4 because both schedules have the following properties:
|
|
|
+- r2(x) reads from w0(x)
|
|
|
+- r1(x) reads from w0(x)
|
|
|
+- w2(z) is the final write
|
|
|
+
|
|
|
+
|
|
|
+Meanwhile S5 and S6 are view serializable because in both schedules:
|
|
|
+- r1(x) reads from w0(x)
|
|
|
+- r2(x) reads from w1(x)
|
|
|
+- w1(z) is the final write
|
|
|
+
|
|
|
##### Another Example
|
|
|
```
|
|
|
S7: r1(x) r2(x) w1(x) w2(x)
|
|
|
S8: r1(X) r2(x) w2(x) r1(x)
|
|
|
S9: r1(x) r1(y) r2(z) r2(y) w2(y) w2(z) r1(z)
|
|
|
```
|
|
|
-#### Complexity
|
|
|
-Deciding view-equivalence of two given schedules can be done in polynomial time
|
|
|
+
|
|
|
+- S7 correspond to a lost update
|
|
|
+- S8 correspond to a non repeatable read
|
|
|
+- S9 correspond to a ghost update
|
|
|
+- They are all non view serializable
|
|
|
+
|
|
|
+##### Complexity
|
|
|
+Deciding view-equivalence of two given schedules can be done in polynomial time
|
|
|
Deciding View-serializability of a generic schedule is a NP-complete problem
|
|
|
|
|
|
-Every conflict serializable schedule is also view-serializable, but the converse is not necessarily true
|
|
|
+#### CSR
|
|
|
+
|
|
|
+An action ai is conflicting with aj (i!=j) if both are operations on common data and at least one of them is a write operation.
|
|
|
+- read-write conflicts (rw, wr)
|
|
|
+- write-write conflicts (ww)
|
|
|
+
|
|
|
+Two schedules are conflict-equivalent if they contain the same operations and all conflicting operation pair occur in the same order.
|
|
|
+One schedule is conflict-serializable if it is conflict-equivalent to a serial schedule.
|
|
|
+
|
|
|
+CSR is the set of conflict-equivalent schedules.
|
|
|
+
|
|
|
+##### CSR and VSR
|
|
|
+
|
|
|
+Every conflict-serializable schedule is also view-serializable, but the converse is not necessarily true
|
|
|
+
|
|
|
+In order to prove that $\;CSR\subset VSR\;$ we have to prove that conflict-equivalence implies view-equivalence.
|
|
|
+
|
|
|
+Let S1 and S2 be two conflict-equivalent schedules:
|
|
|
+- They have the same final writes, if they didn't, there would be at least two writes with a different order
|
|
|
+- They have the same reads-from relations, if they didn't, there would be at least one read-write pair with a different order
|
|
|
+
|
|
|
+So this implies that S1 and S2 are also view-equivalent.
|
|
|
+
|
|
|
+#### Testing conflict-serializability
|
|
|
+
|
|
|
+It is done with a conflict graph that has:
|
|
|
+- One node for each transaction Ti
|
|
|
+- One arc from Ti to Tj if it exists at least one conflict between an action of Ti and an action of Tj such as ai precedes aj.
|
|
|
+
|
|
|
+A schedule is in CSR iff its conflict graph is acyclic.
|