TRANSACTION
MANAGEMENT
Definition: It
is a set of operations that changes the state of db from one consistent state
to next. A transaction is the unit of program execution that accesses and
possibly updates various data items.
A – ATOMICITY (all or nothing)
- It means that either all the effects of transaction are reflected in the db or none are. A failure can leave the db in a state where a transaction is partially executed.
- It means either all or none of the transaction operations are performed.
C – CONSISTENCY (no violation of integrity
constraints)
- It ensures that if initially consistent, execution of the transaction leaves db in a consistent state.
- Ensuring this property of transaction is the responsibility of the user.
I – ISOLATION (concurrent change invisible)
- It ensures that concurrently executing transactions are isolated from each other, so that each has impression that no other transaction is executing concurrently with it.
- The data used during execution of transaction can’t be used by second transaction till the first one is completed.
D – DURABILITY (committed update persist)
- It ensures that once a transaction has been committed, that transaction’s updates do not get lost, even if there is a system failure.
Note: a
sequence of execution of two or more concurrent transaction that will result in
a different of db depending upon their order of transaction.
Transaction State:
The transaction must be in one of the
following states:
- Active: it is the initial state; here transaction remains in this while it is being executed.
- Partially Committed: transaction is in ‘this’ state after the final statement of ‘this’ transaction has been executed.
- Roll-Back: transaction is in this state when the changes caused by an aborted transaction have been undone.
- Save-Point: here, partially completed processes are marked and stored so that, later on, it can run to its completion.
- Failed: it occurs,(after discovering the fact) when normal execution can no longer proceed.
- Aborted: after transaction has been rolled back and the db has been restored to its state prior to the start of the transaction.
- Committed: after successful completion.
Concurrent Transaction
Those transaction that execute in parallel
and results in same consistent state of a db irrespective of their sequence of
completion are termed as CONCURRENT TRANSACTION.
However, if the sequence of completion alters
the state of a db such transaction needed to be serialized during their
execution to ensure the consistent state of the db (as per business logic).
Concurrent execution of transaction improves
throughput of the transaction and system utilization and also reduces waiting
time of the transactions.
Serialized Concurrent Transaction:
The interval of time during which
concurrently executing transaction is serialized is referred as serialized concurrent transaction.
Those transaction which were serialized due
to the serialization of schedule, is called serialized concurrent transaction.
eg –
here, transaction are serialized as T1 and T2
only one execute and
T1 will be executed at first.
so, T1 will
be serialized.
if
not, it could lead to mishap.
Comments
Post a Comment