Unit 4 Flashcards
What is transaction ?
set of operations used to perform a logical unit of work.
What is Full form of ACID (properties) ?
Atomicity , Consistency , Isolation , Durability.
Meaning of Atomicity in context of Transactions ?
Either all operations are performed or none.
Meaning of Consistency in context of Transactions ?
Before and after transaction sum of money should be same. (state of data should should be consistent)
Meaning of Isolation in context of Transactions ?
A parallel schedule should be able to converted into serial schedule to achieve consistancy.
Meaning of Durability in context of Transactions ?
Changes made in DB should be permanent.
What are the operation that are performed in a transaction
- Read
- Write
- Commit
- Rollback
What are states of transaction
- Active
- Partially Committed
- Commited
- Terminated State : (Involves Resource Deallocation)
- Failed
- Abort :
What happens in active state ?
The transaction begins and is actively executing operations.
It can read and write in this state
ex. A bank transaction starts by reading your account balance.
What happens in partially committed state
Transaction has finished it’s operations, but changes have not yet been parmanently saved (commited) to database.
ex. after removing money from your account and adding to another account , the transaction is ready to be finalized but hasn’t been saved yet.
What happens in committed state ?
The transaction is successfully completed, and all changes are permanently saved in the database.
Example: The money transfer is now permanent, and both account balances are updated.
What happens in failed state
Something goes wrong during the transaction (e.g., a system crash or a data error).
The transaction cannot proceed to the next step. It goes in failed state.
Example: If there’s a power failure while transferring money, the transaction cannot continue.
What happens in aborted state ?
In this state , the transaction is rolled back, undoing any changes made during its active state.
To achieve consistency
Example: If the power failure occurs, the transaction will undo the transfer, returning the account balances to their original amounts.
What happens in terminated State ?
This state is achieved when transaction has finished it’s process either by committing or abortion.
Final state where transaction ends.
Example: After either successfully transferring the money or rolling back the changes due to an error, the transaction is considered complete.
What is schedule ?
It is chronological execution sequence of multiple transactions
What are types of schedule
- Based on Serializability
- Serial Schedule
- Parallel Schedule
- Based on Recoverability
- Recoverable
- Irrecoverable
What is serial Scheduling
In this scheduling execution of one transaction stats only after completion of Other transaction
This scheduling can be carried in controlled way.
Here Database remains consistent by nature
ex. In ATM one user can at a time withdraw money
What is parallel transaction
More than one transactions are executed at a time.
Waiting time is less for all transactions. i.e. throughput increases.
what is recoverable and irrecoverable schedule
A recoverable schedule in database transaction management ensures that if a transaction needs to be rolled back due to a failure, it doesn’t cause other dependent transactions to be in an inconsistent state.
irrocoverable don’t guarantee consistance after system in between failure
Example of recoverable schedule
T1 :R(A)
T1 : A=A+10
T1 : W(A)
T2 : R(A) (Dirty Read)
T2: A=A-5
T2 : W(A)
C : T1
C : T2
How to identify if some process is irrecoverable
If one transaction is doing dirty read and the one who is doing dirty read (copying is commited before) then it is irrecoverable otherwise recoverable
example of irrecoverable schedule
T1 :R(A)
T1 : A=A+10
T1 : W(A)
T2 : R(A) (Dirty Read)
T2: A=A-5
T2 : W(A)
C : T2
C : T1
What is cascade roleback ?
A cascaded rollback occurs when a failure in one transaction causes other transactions, which have read data from the failed transaction, to also be rolled back. This can lead to a chain reaction of rollbacks.
What is cascadeless roleback
A cascadeless rollback avoids chain reaction of roleback by ensuring that transactions only read data that has already been committed by other transactions. This way, if a transaction fails and rolls back, it doesn’t affect other transactions.
how to achieve cascadelessness
to achieve cascadelessness we have to completely avoid dirty read problem i.e. one transaction only reads when its previous process has commited its transaction
When can we say that schedule is conflict serializable
When we swap any non conflicting operations and they became e