Professional Documents
Culture Documents
Transaction Managment
Transaction Managment
TRANSACTION
◼ A-Atomicity:
❑ All or nothing approach
◼ C-Consistency
❑ Change in one is reflected to another table of DB
◼ I-Isolation
❑ Several transactions are carried out concurrently
◼ D-Durability
❑ Completed or committed transactions should
persist even after Crash or Failures.
Transaction States
◼ Active:
❑ Initial state & stays there during execution.
◼ Partially Committed
❑ When executed the final statement.
◼ Failed
❑ Cannot execute
transaction normally.
◼ Aborted
❑ Database rolled back
to prior state after failure.
After this we can either:
◼ Kill transaction
◼ Restart transaction
◼ Committed:
❑ After successful
completion.
Transaction Operations
◼ READ(X):
❑ Transfers data item ‘X’ from database to local
buffer of transaction.
◼ WRITE(X):
❑ Transfers data item ‘X’ from local buffer of
transaction to be written in database.
Transaction Log
◼ DBMS uses transaction log to keep track of all updates done to
database.
◼ Information stored there is used for recovery during
❑ ROLLBACK statement, Abnormal termination & System failure.
◼ It stores records of:
❑ Beginning of transaction.
❑ For each transaction:
◼ Type of operation being performed
◼ Name of objects affected by transaction
◼ “before” & “after” values for fields being updated
◼ Pointers to previous & next transaction log entries.
❑ Ending of transaction.
Tri_id Trx_no Prev Next Operation Table Row id Attribute Before After
Ptr Ptr Value Value
341 101 Null 352 START *** Start
Transaction
352 101 341 365 UPDATE PRODUCT 1558- PROD- 25 23
QWI QOH
365 101 352 Null COMMIT *** End
Transaction
Transaction Schedule
◼ “SCHEDULE”
❑ is a list of actions (reading, writing, aborting or committing)
from set of transactions,
❑ which consist of all instructions of those transactions, &
❑ Must preserve order in which instructions appear in these
individual transactions.
◼ It represents an actual execution sequence.
◼ Transaction schedule can be:
❑ Compete Schedule
❑ Serial Schedule
❑ Non-Serial Schedule
❑ Equivalent Schedule
❑ Serializiable Schedule
Complete Schedule