Types of Failure And ACID Property

Q. What do you mean by transaction?
A transaction is a logical unit of work, which involves may database operations. A transaction is a collection of operations that forms a single logical unit of work. A transaction is a unit of program executions that accesses and possibly updates various databases. Example: Banking system, Student database performs transactions.

Types of Failure
1. Transaction failures: It causes a transaction to fail. It is again of 2 types. •Logical error: When transaction can no longer continue with its normal execution because of some internal condition such as bad i/p, data not found, data overflow etc. it gives incorrect result. This is logical error. Ex: any student data. •System error: When system enters in some undesirable state, then also the transaction can’t continue it’s normal execution. Ex: deadlock state.

2. System crash: In system crash there is a h/w malfunction or a bug in the database s/w or the operating system, that causes the loss of content of volatile storage and brings transaction processing to a halt.

3.Disk failure: In this, a disk block loses its content as a result of
either head crash or failure during data transfer operation. Copies of data on other disk as tapes are used to recover them from failure.

Transaction States





A transaction must be in one of the following states:

Active - It is initial state of transaction, transaction always
stays in this state while it is executing.

Partially committed – Transaction stays in this state after the final statement of the transaction has been executed. At this point, the transaction has completed its execution, but it is still possible that it may have to be aborted. Since the actual output may still be there in main memory, and thus a h/w failure may preclude its successful completion.

Failed – After the discovery that normal execution can no longer proceed, transaction enters in final state. Aborted - After the transaction has been rolled back and the database has been restored to its state prior to the start of the transaction, it enters in aborted state. Committed – A transaction is in this state after it has successfully completed it’s execution.

ACID Property

ACID properties are the properties of transaction. A C I D Atomicity Consistency Isolation Durability

Atomicity: Transactions are atomic, i.e., either all operations of transactions are reflected in the database properly, or none are. Consistency: Transactions preserve database consistency, i.e., a transaction transforms a consistent state of database into

another consistent state, without preserving consistency at all intermediate points. Isolation: Even though, multiple transactions may execute concurrently, the system guarantees that, for every pair ti and tj, it appears to ti that either tj finished execution before ti started or tj started execution after ti finished. Thus each transaction is unaware of other transactions executing concurrently in the system.

Durability: Once a transaction commits, it updates survive in the database, even if there is a subsequent system crash.

Access to the Database

Access to the database is accomplished by following two operations – I) Read (X) – Which transfers the data item X from the II)
database to a local buffer belonging to the transaction that executed the read operation. Write (X) – Which transfers the data item X from the database to a local buffer of the transaction and executed the write operation back to the database.

Requirement of ACID Property For Example:
Let, We Have a Transaction T T: read (X); X: = X-50; Write (X); Read (Y); Y=Y+50; Write (Y);

This transaction transfers $50 from acc. X to acc. Y

Consistency: Requirement here is that sum of the amounts of
both the account should be same before and after transaction. As money cannot be destroyed or created.

Atomicity: Let the amount is $5000 in X and $2000 in Y prior to the
execution of the transaction T. While execution of T, a failure (say h/w or s/w or power failure) has occurred that prevented T from completing it successfully. So atomicity says either complete execution of transaction T should take place or there should be no transaction, that is handled by Transaction-management component. Isolation: This property ensures that the concurrent execution of transaction results in a system state that is equivalent to a state that could have been obtained had these transactions executed one at a time in some order. It is the responsibility of system called concurrency-control component.

Durability: This property guarantees that, once a transaction
completes successfully, all the updates that it carried out on the database persist, even if there is a system failure after the transaction completes execution. Ensuring durability is the responsibility of Recoverymanagement component.

Sign up to vote on this title
UsefulNot useful