IBM 000-8697 User Manual

Page of 702
2-74
IBM Informix OnLine Database Server Administrator’s Guide
How OnLine Synchronizes Buffer Flushing
How OnLine Synchronizes Buffer Flushing
Buffer flushing occurs within the context of OnLine activity. When OnLine is
first initiated, all buffers are empty. As processing occurs, data pages are read
from disk into the buffers and user processes begin to modify these pages.
(Refer to
for an explanation of the “before-images first” rule, which
is the reason that synchronization is necessary. In addition,
lists the
four events that prompt buffer-pool flushing and cross-references to further
background information.)
Before a page in shared memory is modified for the first time, a copy of the
page “before-image” is written to the physical log buffer. Subsequent modifi-
cations to that page in shared memory do not result in additional “before-
images” being written to the physical log; only the first modification does so.
After each modification, a record of the change is written to the logical log
buffer if the database was created with logging or if the change affected the
database schema.
MLRU
queues begin to fill with modified pages. Each modified page includes
a timestamp that describes the time at which the page was modified.
Eventually the number of modified buffers in the
MLRU
 queues reaches
LRU_MAX_DIRTY
 and page cleaning begins.
The pages in the physical log buffer are always flushed to disk prior to
flushing the pages that are contained in the modified buffers in the shared-
memory buffer pool. (Refer to
When page cleaning is initiated from the shared-memory buffer pool, the
daemon process performing the page cleaning must coordinate the flushing
so that the physical log buffer is flushed first.
How is this done? The answer is timestamp comparison. (Refer to
for
a definition of a timestamp.)
Shared memory contains a structure that stores a timestamp each time the
physical log buffer is flushed. If a tbpgcl or tbinit daemon needs to flush a
page in a shared-memory buffer, the daemon process compares the
timestamp in the modified buffer with the timestamp that indicates the point
when the physical log buffer was last flushed.