CS FundamentalsVery hardGATE CS
The system crashes after the last record of this log (immediate modification; <Ti, X, old, new>; at the checkpoint all dirty pages were flushed and T2, T3 were active): <T1 start> <T1, A, 10, 20> <T2 start> <T2, B, 5, 15> <T1 commit> <T3 start> <T3, A, 20, 30> <checkpoint {T2, T3}> <T2, C, 1, 2> <T2 commit> <T3, B, 15, 25> After undo/redo recovery, what are A, B and C?
- A. A = 30, B = 25, C = 2
- B. A = 20, B = 5, C = 1
- C. A = 20, B = 15, C = 2
- D. A = 10, B = 15, C = 2
Correct answer: C. A = 20, B = 15, C = 2
T2 committed after the checkpoint, so it is redone (B = 15, C = 2); T3 never committed, so its writes are undone in reverse: B back to 15, A back to 20. T1 committed before the checkpoint and needs nothing, so A is not rolled back to 10.
More DBMS and SQL questions
- A buffer manager uses NO-STEAL (pages with uncommitted changes are never written to disk) and FORCE (all pages a transaction changed are…
- T1 reads the balance of account 7, then T2 updates that same row and commits, then T1 reads the row again and sees a different value. No…
- No transaction has committed. T1 writes A; T2 reads A and writes B; T3 reads B; T4 reads C, which only T5 wrote; T5 reads nothing written…
- A table has 1,000,000 rows in 10,000 blocks. A range predicate selects 20% of the rows, which are spread evenly across the table. There is…
- Table T(a, b, c) has a composite B+ tree index on (a, b), and the query is SELECT b FROM T WHERE a = 5. What is the main benefit of this…
- In extendible hashing, the global depth is 3 and a full bucket with local depth 2 must split on an insert. What happens?