IBM 000-8697 Server User Manual


 
System Architecture 2-65
Physical Log Buffer
The contents of the physical log buffer must always be flushed to disk before
any data buffers. This rule is required for fast recovery. (Refer to page 4-39 for
a definition of fast recovery. Refer to page 2-74 for a description of physical
log buffer flushing when it is prompted by the need to flush the shared-
memory buffer pool. Refer to page 2-72 for a description of the checkpoint
procedure.)
Flushing a Full Buffer
Buffer flushing that results from the physical log buffer becoming full
proceeds as follows.
When a user process needs to write a page to the physical log buffer, it
acquires the latch associated with the physical log buffer and the latch
associated with the physical log on disk. If another user process is writing to
the buffer, the incoming user process must wait for the latches to be released.
After the incoming user process acquires the latches, before the write, the
user process first checks the physical log for fullness. If the log is more than
75 percent full, the user process sets a flag to request a checkpoint, performs
the write to the physical log buffer, and then releases the latch. The check-
point cannot begin until all shared-memory latches, including this one, are
released.
If the log is less than 75 percent full, the user process compares the incre-
mented page counter in the physical log buffer header to the buffer capacity.
If this one-page write does not fill the physical log buffer, the user process
reserves space in the log buffer for the write and releases the latch. Any user
process waiting to write to the buffer is awakened. At this point, after the
latch is released, the user process writes the page to the reserved space in the
physical log buffer. This sequence of events eliminates the need to hold the
latch during the write and increases concurrency.
If this one-page write fills the physical log buffer, flushing is initiated as
follows.