Saturday, April 2, 2016

Durability property of ACID properties

ACID Properties, Properties of Database Transactions, Atomicity Explained, Example for Atomic transactions

Durability property - ACID Properties


Let us consider a transaction T1 through which you want to transfer 2000 from your account ‘A’ (source account) to your friend’s account ‘B’ (destination account). Assume that the account balance of A is 10000 and B is 14000. This transaction can be represented as follows;

Instructions in Transaction T1
Meaning
Example
Step 0: Begin_Transaction
The starting point of the current transaction.
T1 started. At this stage A = 10000 and B = 14000.
Old consistent state
Step 1: Read (A);
Read the current balance of A from database.
A’s current balance is 10000.
Step 2: A := A – 2000;
Deduce the amount to be transferred from the source account.
A := 10000 – 2000;
Step 3: Write (A);
Write the new value of A into database.
A’s new balance is 8000.
Step 4: Read (B);
Read the current balance of B from database.
B’s current balance is 14000.
Step 5: B := B + 2000;
Add the transferred amount (amount deduced from A) to destination account B.
B := 14000 + 2000;
Step 6: Write (B);
Write the new value of B into database
B’s new balance is 16000.
Step 7: Commit;
Permanently write values of A and B into database.
At the end of the transaction,
A = 8000 and B = 16000.
New consistent state
Table: Transaction T1

From the above example, we would know that if the transaction executed the instructions in Step 0 to Step 7, then we would say that this transaction T1 is successfully completed. All these steps have to be executed successfully, safely and without any other external intervention. To ensure this we use to check the transaction properties.


Durability – The changes made to the database during a successful transaction must persist in the database. In other words, the updates carried out by a successful transaction must be permanently reflected in the database even if any failure occurs after commit. It is the responsibility of the recovery subsystem to ensure durability.
For example, in T1, we must see 8000 and 16000 as the current balances of account A and B respectively after the commit has reached. After commit has reached, if any failure occurs, we must not lose the updates.

******************
 

Go back to ACID properties home page

Go to Atomicity

Go to Isolation











No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery