Assume I have the following concurrent transactions:
----------------------
|Ti | Tj |
----------------------
| write(Q) | |
----------------------
| | read(Q) |
----------------------
| read(Q) | |
----------------------
| | write(Q)|
----------------------
| write(Q) | |
----------------------
| | write(Q)|
----------------------
If we draw the precedence-graph, we'll see that it is not conflict-serializable. Since the graph will be cyclic. The reason is:
----------------------
| | write(Q)|
----------------------
| write(Q) | |
----------------------
| | write(Q)|
----------------------
From the book: "Database System Concepts - 6th edition" source
If a schedule S can be transformed into a schedule S' by a series of swaps of non-conflicting instructions, we say that S and S' are conflict equivalent. We say that a schedule S is conflict serializable if it is conflict equivalent to a serial schedule.
Now, what does this swap
means?
Can I do something like:
----------------------
|Ti | Tj |
----------------------
| write(Q) | |
----------------------
| read(Q) | |
----------------------
| write(Q) | |
----------------------
| | read(Q) |
----------------------
| | write(Q)|
----------------------
| | write(Q)|
----------------------
Or can I change the order?
----------------------
|Ti | Tj |
----------------------
| read(Q) | |
----------------------
| write(Q) | |
----------------------
| write(Q) | |
----------------------
| | read(Q) |
----------------------
| | write(Q)|
----------------------
| | write(Q)|
----------------------
Regards
P.S. I looked at other answer but it is not explaining the swap
operation.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…