Tom Lane wrote:

Bruce Momjian <[EMAIL PROTECTED]> writes:
Now, if we are sure that writes will happen only in the checkpoint
process, O_SYNC would be OK, I guess, but will we ever be sure of that?

This is a performance issue, not a correctness issue. It's okay for backends to wait for writes as long as it happens very infrequently. The question is whether we can design a background dirty-buffer writer that works well enough to make it uncommon for backends to have to write dirty buffers for themselves. If we can, then doing all the writes O_SYNC would not be a problem.

(One possibility that could help improve the odds is to allow a certain
amount of slop in the LRU buffer reuse policy --- that is, if you see
the buffer at the tail of the LRU list is dirty, allow one of the next
few buffers to be taken instead, if it's clean.  Or just keep separate
lists for dirty and clean buffers.)

If the checkpointer is writing in LRU order (which is the order buffers normally get replaced), this happening would mean that the backends have replaced all clean buffers at the LRU head and this can only happen if the currently running checkpointer is working way too slow. If it is more than 30 seconds away from its target finish time, it would be a good idea to restart by building a (guaranteed long now) new todo list and write faster (but starting again at the LRU head). If it's too late for that, stop napping, finish this checkpoint NOW and start a new one immediately.



Jan


--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== [EMAIL PROTECTED] #


---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to