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
- Consider the tables Students(Roll-No, Name) and Performance(Roll-No, Course, Marks) shown below; Students also contains the row (18CS103, R…
- A clustering index is defined on the fields which are of type
- In RDBMS, which type of Join returns all rows that satisfy the join condition ?
- Consider a relation book (title, price) which contains the titles and prices of different books. Assuming that no two books have the same p…
- In a Hierachical database, a hashing function is used to locate the ________.
- Relations produced from E - R Model will always be in ________.