Re: Logical Logs -Explain
Posted in 1997
> Regarding Flushing of logs/buffers to disk > 1)What is a FOREGROUND WRITE? A foreground write is a very bad thing for performance. Basically, there are three ways for modified pages to be written back to disk from the buffer cache: 1. Chunk writes 2. LRU writes 3. Foreground writes Chunk writes occur at checkpoint time. All of the modified pages are queued up in page-number order and written in ascending order to minimize back and forth seeking of the disk read/write head. LRU writes occur between checkpoints, depending on the values of LRU_MAX_DIRTY and LRU_MIN_DIRTY onconfig parameters. The least recently used dirty pages are written back to disk in order of age within LRU queue, so there can be a lot of head seeks. Foreground writes happen when a user thread needs a buffer to read a page from disk but there are no free pages in the buffer. The user thread will interrupt its normal processing and find a buffer that isn't locked by another thread, then write that buffer back to disk, then it will resume the read operation and bring the page it was fetching into the buffer it just freed. > 2) "If page cleaner activity begins and a modified page is writtn to disk > ,it would be possible for the modified version of the page to be on disk , > but the before image to still be in the Physical logbuffer.Also, if a user > thread initiated a foreground write on such a page , the same situation > could occur" > What does the last sentence mean? It means that the user thread had to free a buffer, as described above. The modified buffer is written to disk, but the physical log holds the before image of every page that has been modified since the last checkpoint. This before image is used to ensure consistency during fast recovery when OnLine is started after a crash. I believe what they are getting at here is that the before image could be in the physical log BUFFER instead of actually on DISK. If the machine (or database server) crashed while this was the case, you would have an inconsistency. My understanding from reading DSA Admin Guide is that Informix prevents this by forcing the physical log buffer to be flushed prior to the dirty buffer cache buffer from being written back to disk. What manual and page did your quote come from? Mark Collins mcollins@us.dhl.com The problem lies in how easily and dangerously we forget that manipulating things is not the same as understanding them.