Transaction State Diagram
Because failure of the transaction may occur, the transaction is broken up into states to handle various situations.
Following the different states in transaction processing in database
- Partial committed
- This is the initial state in Transaction State Diagram. The transaction stays in this state while it is executing.
- This is the state after the final statement of the transaction executed.
- At this point failure is still possible since changes may have only done in main memory, a hardware failure could still occur.
- The DBMS needs to write out enough information to disk so that, in case of a failure, the system could re-create the updates performed by the transaction once the system is brought back up.
- After it has written out all the necessary information, it committed.
- After the discovery that normal execution can no longer proceed.
- Also, Once a transaction cannot complete, any changes that it made must be undone rolling it back.
- Moreover, The state after the transaction has been rolled back and the database has been restored to its state prior to the start of the transaction.
- The transaction enters in this state after successful completion of the Transaction State Diagram.
- We cannot abort or rollback a committed transaction.
Some Interesting Terms for Transaction Management
- A schedule is the chronological (sequential) order in which instructions executed in a system.
- Also, A schedule for a set of a transaction must consist of all the instruction of those transactions and must preserve the order in which the instructions appear in each individual transaction.
- The schedule that does not interleave the actions of different transactions.
- Moreover, In schedule 1 the all the instructions of T1 grouped and run together. Then all the instructions of T2 grouped and run together.
- Means schedule 2 will not start until all the instructions of schedule 1 complete. This type of schedules called serial schedule.
- The schedule that interleaves the actions of different transactions.
- Means schedule 2 will start all instructions of schedule 1 completed. This type of schedules called interleaved schedule.
- Two schedules are equivalent schedule if the effect of executing the first schedule is identical (same) to the effect of executing the second schedule.
- We can also say that two schedules are equivalent schedule if the output of executing the first schedule is identical (same) to the output of executing the second schedule.
- A schedule that is equivalent (in its outcome) to a serial schedule has the serializability property.