System Architecture 2-63
Physical Log Buffer
If the user process intends to modify the buffer, it acquires a latch on the
buffer and changes the buffer lock-access type to exclusive.
Acopy of the “before-image” of the page is needed for data consistency. The
userprocess determines if a “before-image” of this page was written to either
the physical log buffer or the physical log since the last checkpoint. If not, a
copy of the page is written to the physical log buffer.
The data in the page buffer is modified, including the timestamps on the
page. When the modification is complete, the latch on the buffer is released.
Ifany transaction records are required for logging, those records are written
to the logical log buffer.
After the latch on the buffer is released, the user process is ready to release
thebuffer. First, the releasing user process acquires a latch on the buffertable
that enables it to modify the buffer entry.
Thereleasing process updates the timestamp in the buffer header so that the
timestamp on the buffer page and thetimestamp in the header match.
Statistics describing the number and types of writes performed by this user
process are updated.
The lock is released as described in the previous section, but the buffer is
appendedto the MLRU queue associated with its original queue set. (Refer to
page 2-57). If the latch for thatMLRU queue is unavailable, the process tries
to acquire a latch for a randomly selected MLRU queue. When theMLRU
queue latch is acquired, the modified buffer is linked to the “most-recently
used” end of the queue.
Physical Log Buffer
OnLineuses the shared-memory physical log buffer as temporary storage of
“before-images”of disk pages. Before a disk page can be modified, a “before-
image”of the page on disk must already be stored in the physical log on disk
or one must be written to the physical log buffer. In the latter case, the
physical log buffer must be flushed to disk before the modified page can be
flushed to disk. Writing the “before-image” to the physical log buffer and
thenflushing the buffer page to disk is illustrated in Figure 2-8 on page 2-64.
Both the physical log buffer and the physical log maintain the physical and
logical consistency of OnLine data.