in Databases edited by
8,735 views
30 votes
30 votes

Consider the following transaction involving two bank accounts $x$ and $y$.

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

The constraint that the sum of the accounts $x$ and $y$ should remain constant is that of 

  1. Atomicity
  2. Consistency
  3. Isolation
  4. Durability
in Databases edited by
8.7k views

4 Comments

shots fired, shots fired.

1
1
There is nothing to do with given transaction it is just for confusing since it is application dependent constraints (i.e Explicit constraints) for which consistancy of database is responsible.
0
0
0
0

4 Answers

25 votes
25 votes
Best answer
B. Consistency

In the given transaction Atomicity guarantees that the said constraint is satisfied. But this constraint is not part of Atomicity property. It is just that Atomicity implies Consistency here.
selected by
by

4 Comments

Yes, exactly. A calm mind gets a lot of mark in GATE :)
19
19
@Arjun sir. Suppose the answer is Isolation to the modified version of this problem. Can you please help what can be the modified version?This will clear some doubt.
1
1

Hi All,

Why can't we go with option durability?

As per question The sum of account x and y should remain constant .

So even if there is some failure the values should not change and final values should be retained. So I beleive answer might be durability.

Some one please correct me if my understanding is wrong.

0
0
15 votes
15 votes

Answer (B)

Explaination:

Transaction to transfer $50 from account A to account B:

  1. read(A);
  2. A:=A-50;
  3. write(A);
  4. read(B);
  5. B:=B+50;
  6. write(B);
  • Atomicity requirement
    • if the transaction fails after step 3 and before step 6, money will be “lost” leading to an inconsistent database state.
      • Failure could be due to software or hardware.
    • the system should ensure that updates of a partially executed transaction are not reflected in the database.
  • Durability requirement

    • once the user has been notified that the transaction has completed (i.e., the transfer of the $50 has taken place), the updates to the database by the transaction must persist even if there are software or hardware failures.

  • Consistency requirement

    • (in above example) the sum of A and B is unchanged by the execution of the transaction.

    • In general, consistency requirements include

      • Explicitly specified integrity constraints such as primary keys and foreign keys.

      • Implicit integrity constraints- e.g. sum of balances of all accounts, minus sum of loan amounts must equal value of cash­ in­ hand.

    • A transaction must see a consistent database.

    • During transaction execution the database may be temporarily inconsistent.

    • When the transaction completes successfully the database must be consistent.

      • Erroneous transaction logic can lead to inconsistency

  • Isolation requirement

    • if between steps 3 and 6, another transaction T2 is allowed to access the partially updated database, it will see an inconsistent database (the sum A + B will be less than it should be).

    • Isolation can be ensured trivially by running transactions serially.

Answer source.

1 comment

This should be the marked answer
0
0
11 votes
11 votes
Kindly check out PPT for Transaction chapter in below link.( Part 5: Transaction Management Ch. 15)

http://www.cse.iitb.ac.in/~sudarsha/db-book/slide-dir/

Question is directly taken from Korth. And wording almost completely matches to Consistency requirement.

2 Comments

link is not working
3
3

@Lakshman Patel RJIT sir plz update the link as it’s not working 

0
0
1 vote
1 vote
Consistency so option b
Answer:

Related questions