
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.
A copy of the “before-image”of the page is needed for data consistency. The
userprocessdeterminesifa“before-image”ofthispage waswrittentoeither
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.
If any 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,thereleasinguserprocess acquiresa latch on thebuffertable
that enables it to modify the buffer entry.
The releasing process updatesthe timestampin thebuffer header so that the
timestamp on the buffer page and the timestamp 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
appendedtotheMLRU queueassociatedwithitsoriginalqueueset.(Referto
page 2-57). If the latch for that MLRU queue is unavailable, the process tries
to acquire a latch for a randomly selected MLRU queue. When the MLRU
queue latch is acquired, the modified buffer is linked to the “most-recently
used” end of the queue.
Physical Log Buffer
OnLine uses the shared-memory physical log buffer as temporary storage of
“before-images”ofdisk pages. Beforea disk pagecan be modified,a“before-
image”ofthe page ondiskmustalreadybestoredin the physicallogondisk
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
then flushing the buffer page todisk isillustrated in Figure 2-8on page 2-64.
Both the physical log buffer and the physical log maintain the physical and
logical consistency of OnLine data.
Comentarios a estos manuales