LSN-based logging
Each database page P’s header has the LSN of the last log record whose operation updated P.
Restart compares log record and page LSN before redoing the log record’s update U.
- Redo the update only if LSN(P) < LSN(U)
Undo is a problem. If U’s transaction aborts and you undo U, what LSN to put on the page?
- Suppose T1 and T2 update records x and y on P
- w1[x] w2[y] c2 a1 (what LSN does a2 put on P?)
- not LSN before w1[x] (which says w2[x] didn’t run)
- not w2[y] (which says w1[x] wasn’t aborted)
- not a1 (have to latch all of T1’s pages while aborting)