in Databases edited by
1,603 views
1 vote
1 vote

Somebody please explain this i am not able to understand please given an example of transaction or explain in hindi what the question and answer is please explain somebody please

Here i am posting the Entire Question with some Multiple Choices and a Perfect Example now please somebody please explain which choice is correct and which is wrong

I am not able to understand it.

in Databases edited by
1.6k views

2 Answers

2 votes
2 votes
It is basically saying that if the write locks are released before the data is saved, then a new transaction might come, use the data, change its value and then commit before the commit of the first transaction occurred. After that at some later time, the first transaction finishes it commit.

There are two issue here, the data read by the second transaction is old data (in ideal situation it should have used the value which the first transaction provides) and the other issue if that the after the first transaction finishes its commit, the commit done  by the second transaction is lost.

Hope this helps.

4 Comments

@sandeep ,

"the other issue if that the after the first transaction finishes its commit, the commit done  by the second transaction is lost."

Sir , I m not getting this statement.. Can you please explain here...
1
1
@ankit

Transaction 1 (T1) does not anything about the Transaction 2 (T2).

Lets say T1 and T2 both wants to add 10 and 20 to the variable, M whose current value is 100.

T1 comes first, reads M (=100), adds 10, makes its 110 in its own local copy. Before commit, it goes to sleep.

T2 comes, reads M (=100), adds 20, makes its 120 an commits this. M is now 120.

T1 wakes up, and finishes its commit by saving its local M value, which is 110. After commit M becomes 110.

So essentially the commit done by the T2, when its makes the M 120 is lost.
2
2
Ok got it.. Thank u :)
0
0
1 vote
1 vote

.........

by

Related questions