3 votes 3 votes Schedule S:- R1(A) R2(B) R3(C) R1(B) R2(C)R3(D)W1(C)W2(D)W3(E) , following is the dependency graph Which of the transaction is rollbacked if Time stamp order is? a.) (T1,T2,T3)=(10,30,20) b.)(T1,T2,T3)=(20,10,30) Please explain approach to this? Databases databases timestamp-ordering + – rahul sharma 5 asked Jan 8, 2017 • edited Jan 9, 2020 by KUSHAGRA गुप्ता rahul sharma 5 1.8k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Rahul Jain25 commented Jan 8, 2017 reply Follow Share In a) T1 b)T1 and T2 both rollback. Is it the given answer??? 0 votes 0 votes rahul sharma 5 commented Jan 8, 2017 reply Follow Share Correct.Please explain approach. 0 votes 0 votes Please log in or register to add a comment.
Best answer 2 votes 2 votes Firstly, the precedence graph or dependency graph arrows indicate the order in which conflict operations must be executed. Now in TO lowest TO number indicate oldest Transaction and you must be knowing that in TO protocol if latest transaction has performed a operation then older one is nit allowed it has to rollback. Here in A) T3 has to perform the conflict operation first then the To-number of that data item will become 20 then T2 has to perform ooeration and it will make it 30. Then T1 will be performing operation on that data item but It's TO number is small than 30(TO number of that data item). Hence rollback. Similarly it is for B). Rahul Jain25 answered Jan 8, 2017 • selected Jan 8, 2017 by rahul sharma 5 Rahul Jain25 comment Share Follow See all 6 Comments See all 6 6 Comments reply rahul sharma 5 commented Jan 8, 2017 reply Follow Share The graph shows what actually conflict operations are.So the execution order remains same even if time stamp is changed? We have to execute in the order of presedence graph or in time stamp order?Like i was execeuing them from the time stamp values.For (T1,T2,T3) (10,30,20),I was trying to run it based in time stamp order (T1->T3->T2). TO says we should execute transactions based on time stamp values ,so should i execute (T1->t3->T2) ?or shall we look at presendence graph and then execute?Please clear.I have also updated question with some more info 0 votes 0 votes Rahul Jain25 commented Jan 8, 2017 reply Follow Share Graph only shows us the order in which conflicting operations must be executed. Now R-R is not a conflict, you can execute in any order you want. We have to execute conflict operations in order of given graph and each time we check the TO value of data item, by using TO algorithm, if not satisfied then rollback that transaction. 0 votes 0 votes Rahul Jain25 commented Jan 8, 2017 reply Follow Share One more thing, if (30,20,10) are timestamps then schedule is allowed in TO 0 votes 0 votes rahul sharma 5 commented Jan 8, 2017 reply Follow Share Thanks man:). This concept was biting me for last one hour. 1 votes 1 votes rahul sharma 5 commented Jan 8, 2017 reply Follow Share I need to clear one more point. When values are (T1,T2,T3)=(20,10,30) Then T3 will set to 30.Now T2 will come and t2 will find some younger has done operation so it will rollback. Now T2 will cause t1 to rollback or will T1 execute and then it check that some younger has performed write and rollback itself?I mean the reaon of T1 to rollback is because of T2 rollback or because of TO protocol ,which will cause it to rollback 0 votes 0 votes Rahul Jain25 commented Jan 8, 2017 reply Follow Share T1 rollbacks bcoz of data item had value 30, it is not bcoz of T2, If T1 had Timestamp 40 it would have gone and performed it operation and set value to 40 0 votes 0 votes Please log in or register to add a comment.