914 views
0 votes
0 votes

Consider a database transaction involving two bank account x and y.

read(x)
x=x-50
write(x)
read(y)
y=y+50
write(y)

Which of the following constraints fail if transaction fails after just after write(x) operation.

(A)Atomicity

(B)Durability

(C)Isolation

(D)None

The answer given is (A). But I think Consistency is lost because the database will be left in the Inconsistent state. Consistency should have been more appropriate here and hence (D) should have been the choice. Why (A).

1 Answer

–1 votes
–1 votes

ACID Property:

A - Atomicity : Either full or none. Do or Die.

C - Consistency : After transaction, Database is unchanged.

I - Isolation: Concurrent transaction without making Database inconsistent.

D- Durability: When a transaction is over, all changes made are permanent.

 

So, 

1.read(x)
2.x=x-50
3.write(x)
4.read(y)
5.y=y+50
6.write(y)

If the above transaction fails at 3rd step (i.e.) write(x) , the transaction is not taking place completely. 

According to Atomicity definition above do or die, It can't do. so DIE.

There can be some chances for all other properties but the onw which get affected directly is ATOMICITY Property!

Related questions

2 votes
2 votes
2 answers
1
1 votes
1 votes
2 answers
3
Rutuja Desai asked Dec 2, 2021
659 views
I had a doubt.In the case of lost update problem (special case of write – write problem, where a transaction commits to a blind write and the other transaction rollsbac...
0 votes
0 votes
1 answer
4