Page 92 - CITS - Computer Software Application -TT
P. 92
COMPUTER SOFTWARE APPLICATION - CITS
5 Failed: The failed state is different from the aborted state. A transaction enters the failed state when it
encounters a critical error that prevents it from continuing. In this case, the DBMS automatically rolls back the
transaction to maintain data integrity and consistency.
6 Terminated (or Completed): After a transaction has reached a terminal state (committed, aborted, or failed),
it is considered terminated. The transaction can no longer be modified or interact with the database. It may still
be examined for auditing or debugging purposes.
7 Pending: In some systems, a transaction may enter a pending state temporarily. This typically occurs when
a transaction is waiting for a resource or a lock that is held by another transaction. While in the pending state,
the transaction is not actively executing but is waiting for its turn to proceed.
A transaction is a single logical unit of work that accesses and possibly modifies the contents of a database.
Transactions access data using read and write operations.
In order to maintain consistency in a database, before and after the transaction, certain properties are followed.
These are called ACID properties.
Atomicity
By this, we mean that either the entire transaction takes place at once or doesn’t happen at all. There is no
midway i.e. transactions do not occur partially. Each transaction is considered as one unit and either runs to
completion or is not executed at all. It involves the following two operations.
- Abort: If a transaction aborts, changes made to the database are not visible.
- Commit: If a transaction commits, changes made are visible.
Atomicity is also known as the ‘All or nothing rule’.
Consider the following transaction T consisting of T1 and T2: Transfer of 100 from account X to account Y.
If the transaction fails after completion of T1 but before completion of T2. (say, after write(X) but before write(Y)),
then the amount has been deducted from X but not added to Y. This results in an inconsistent database state.
Therefore, the transaction must be executed in its entirety in order to ensure the correctness of the database
state.
79
CITS : IT&ITES - Computer software application - Lesson 18 - 36