ACID
ACID
Attention reader! Don’t stop learning now. Get hold of all the
important CS Theory concepts for SDE interviews with the CS
Theory Course at a student-friendly price and become industry
ready.
Write (A): Write operation Write(A) or W(A) writes the value back to
the database from buffer.
(Note: It doesn’t always need to write it to database back it just
writes the changes to buffer this is the reason where dirty read
comes into picture)
1. R(A);
2. A=A-1000;
3. W(A);
But it may also be possible that transaction may fail after executing
some of its operations. The failure can be because of hardware,
software or power etc. For example, if debit transaction discussed
above fails after executing operation 2, the value of A will remain
5000 in the database which is not acceptable by the bank. To avoid
this, Database has two important operations:
Properties of a transaction
T1’s buffer
T1 space T2 T2’s Buffer Space Database
A=5000
W(A); A=5500
Table 1
1. read(x);
2. x := x – 50;
3. write(x);
4. read(y);
5. y := y + 50;
6. 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
[GATE 2015]
Solution: As discussed in properties of transactions, consistency
properties says that sum of accounts x and y should remain
constant before starting and after completion of transaction. So, the
correct answer is B.