Please visit, subscribe and share 10 Minutes Lectures in Computer Science

## Atomicity 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.

Atomicity – This is ‘all’ or ‘nothing’ property. It says, either all the instructions (for example, in T1 all the steps) must be completed or no instruction is completed. This property insists that “a transaction as a whole is a single, indivisible logical unit.

In other words, you should see either new consistent state or old consistent state of a transactions data items.

For example, in T1, the steps 0 – 7 must be completed to ensure atomicity. If any failure happens before reaching COMMIT, then we must see old consistent values of A and B. if no failure, then we must see the new consistent values of A and B.

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

Go to Isolation

Go to Durability