All mock tests are FREE till 31 December — register to save your progress
Unit 4 · Database Management Systems Paper 2 CS · December 2018

Consider two transactions on account A (initial balance 20,000): T1 transfers 5,000 to account B, then T2 applies 10% interest to A. The log is:

(i) T1 start

(ii) T1, A, old = 20,000, new = 15,000

(iii) T1, B, old = 12,000, new = 17,000

(iv) T1 commit

(v) T2 start

(vi) T2, A, old = 15,000, new = 16,500 (vii) T2 commit Suppose the database crashes just before log record (vii) is written. When the system restarts, which statement is true of the recovery process?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. We must undo log record (vi) to set A to 16,500 and then redo log records (ii) and (iii).

Explanation

T2 has no commit record, so (vi) is undone; T1 committed, so (ii) and (iii) are redone. Undo comes first, then redo, so order matters.

Note: Undoing (vi) restores A to its old value 15,000; the option's '16,500' is a slip in the question.

More Database Management Systems questions