Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this serializable?

write(T1, balx), read(T2, balx), write(T1, balx), commit(T2), abort(T1)

I'm revising for an exam and these are one of the questions that I've been looking over on the mock paper.

According to the Marking Scheme the answer is that the transaction is serializable. But I just don't understand how.

T1 and T2 get trapped in a cycle as T1 points to T2 and then point backs to T1 in a precedence graph, therefore not making it serializable. Is the marking wrong or am I missing something here?

like image 644
user2212485 Avatar asked May 27 '13 22:05

user2212485


People also ask

How do you know if a transaction is serializable?

If a precedence graph contains a single edge Ti → Tj, then all the instructions of Ti are executed before the first instruction of Tj is executed. If a precedence graph for schedule S contains a cycle, then S is non-serializable. If the precedence graph has no cycle, then S is known as serializable.

Is this schedule view serializable?

A schedule will view serializable if it is view equivalent to a serial schedule. If a schedule is conflict serializable, then it will be view serializable. The view serializable which does not conflict serializable contains blind writes.

How do you know if conflict is serializable?

Example for Conflict Serializability – Two operations are said to be conflicting if the belong to different transaction, operate on same data and at least one of them is a write operation. Constructing the precedence graph, we see there are no cycles in the graph. Therefore, the schedule is Conflict Serializable.

How do we identify serialization of scheduling?

A schedule is called conflict serializable if it can be transformed into a serial schedule by swapping non-conflicting operations. For a schedule to be conflict serializable, there should be no cycle present in its precedence graph. Cycle between T1 and T2.


1 Answers

I think the key thing here is that T1 abort. If I am no mistaken until a transactions commits then it is safe to assume the disk has not been modified. Which means when T1 aborts the state of the database was the same as because this sequence of operation. And this is the T2 is viewing.

Thus, if we had

write(T1, balx), write(T1, balx), abort(T1), read(T2, balx), commit(T2)
read(T2, balx), commit(T2), write(T1, balx), write(T1, balx), abort(T1)

Then the state of the database and of the transactions T2 will be the same as the one in your example. Now if T1 had committed, you will be correct by evoking the precedence graph.

like image 157
UmNyobe Avatar answered Dec 02 '22 11:12

UmNyobe