Re: Checkpoints occur too frequently - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Checkpoints occur too frequently
Date
Msg-id 24551.1103067084@sss.pgh.pa.us
Whole thread Raw
In response to Checkpoints occur too frequently  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: Checkpoints occur too frequently  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-bugs
Simon Riggs <simon@2ndquadrant.com> writes:
> DEBUG1 messages showed that there is an apparent limit of 255 xlog files
> per checkpoint -

The volume-based checkpoint trigger code is

                if (IsUnderPostmaster &&
                    (openLogId != RedoRecPtr.xlogid ||
                     openLogSeg >= (RedoRecPtr.xrecoff / XLogSegSize) +
                     (uint32) CheckPointSegments))
                {
#ifdef WAL_DEBUG
                    if (XLOG_DEBUG)
                        elog(LOG, "time for a checkpoint, signaling bgwriter");
#endif
                    RequestCheckpoint(false);
                }

which now that I look at it obviously forces a checkpoint whenever
xlogid (the upper half of XLogRecPtr) changes, ie every 4GB of WAL
output.  I suppose on a high-performance platform it's possible that
one would want checkpoints further apart than that, though the idea
of plowing through multiple gigabytes of WAL in order to recover from
a crash is a bit daunting.

It's not immediately obvious how to recast the comparison without
either creating overflow bugs or depending on 64-bit-int arithmetic
being available.  Thoughts?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Simon Riggs
Date:
Subject: Checkpoints occur too frequently
Next
From: Simon Riggs
Date:
Subject: Re: Checkpoints occur too frequently