The Log (cont’d)
With record granularity operations, short-term locks, called latches, control concurrent record updates to the same page:
- Fetch(P) read P into cache
- Pin(P) ensure P isn’t flushed
- write lock (P) for two-phase locking
- latch P get exclusive access to P
- update P update P in cache
- log the update to P append it to the log
- unlatch P release exclusive access
- Unpin(P) allow P to be flushed
There’s no deadlock detection for latches.