Re: Load Distributed Checkpoints, revised patch

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Load Distributed Checkpoints, revised patch
Date: 2007-06-15 20:22:46
Message-ID: 20070615202246.GA21399@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Heikki Linnakangas wrote:
> Alvaro Herrera wrote:

> > if (BgWriterShmem->ckpt_time_warn && elapsed_secs <
> > CheckPointWarning)
> > ereport(LOG,
> > (errmsg("checkpoints are occurring too
> > frequently (%d seconds apart)",
> > elapsed_secs),
> > errhint("Consider increasing the
> > configuration parameter
> > \"checkpoint_segments\".")));
> > BgWriterShmem->ckpt_time_warn = false;
>
> In the extremely unlikely event that RequestCheckpoint sets
> ckpt_time_warn right before it's cleared, after the test in the
> if-statement, the warning is missed.

I think this code should look like this:

if (BgWriterShmem->ckpt_time_warn)
{
BgWriterShmem->chpt_time_warn = false;
if (elapsed_secs < CheckPointWarning)
ereport(LOG,
(errmsg("checkpoints are occurring too frequently (%d seconds apart)",
elapsed_secs),
errhint("Consider increasing the configuration parameter \"checkpoint_segments\".")));
}

That way seems safer. (I am assuming that a process other than the
bgwriter is able to set the ckpt_time_warn bit; otherwise there is no
point). This is also used in pmsignal.c. Of course, as you say, this
is probably very harmless, but in the other case it is important to get
it right.

--
Alvaro Herrera http://www.PlanetPostgreSQL.org/
"Hackers share the surgeon's secret pleasure in poking about in gross innards,
the teenager's secret pleasure in popping zits." (Paul Graham)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Maxwell 2007-06-15 20:28:34 Re: Load Distributed Checkpoints test results
Previous Message Gregory Stark 2007-06-15 20:13:01 Re: Load Distributed Checkpoints test results

Browse pgsql-patches by date

  From Date Subject
Next Message David Gardner 2007-06-16 00:23:36 out of date url in developer faq
Previous Message Heikki Linnakangas 2007-06-15 19:49:58 Re: Load Distributed Checkpoints, revised patch