Skip to content
Official PYQ · 2006

GATE CS 2006 Q20 — Transactions and Concurrency Control

Explain with AI

Consider the following log sequence of two transactions on a bank account, with initial balance 12000,12000, that transfer 20002000 to a mortgage payment and then apply a 5%5\% interest. 

  1. T1 start 
  2. T1 B old =12000=12000 new =10000=10000
  3. T1 M old =0=0 new =2000=2000
  4. T1 commit
  5. T2 start
  6. T2 B old =10000=10000 new =10500=10500
  7. T2 commit

Suppose the database system crashes just before log record 77 is written. When  the system is restarted, which one statement is true of the recovery procedure? 

Choose one option
View worked solution

Answer: B

During database recovery after a crash, the system scans the log to identify the status of transactions at the time of the crash:

  • Transaction T1T_1: Both T1 start and T1 commit are present in the log. Since T1T_1 committed before the crash, its actions must be redone to guarantee durability. This means redoing log records 2 and 3.
  • Transaction T2T_2: Only T2 start is present in the log (the crash occurred before T2 commit could be written). Since T2T_2 was active/uncommitted at the time of the crash, its actions must be undone to maintain database consistency. This means undoing log record 6, which restores the value of BB to its old value of 1000010000.

Therefore, the recovery procedure must undo log record 6 (setting BB to 1000010000) and redo log records 2 and 3, which matches Option B.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions