Re: Logging idle checkpoints

From: Andres Freund <andres(at)anarazel(dot)de>
To: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Logging idle checkpoints
Date: 2017-10-01 22:27:46
Message-ID: 20171001222746.usahsm2oblmst4q4@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2017-10-02 00:19:33 +0200, Vik Fearing wrote:
> I recently had a sad because I noticed that checkpoint counts were
> increasing in pg_stat_bgwriter, but weren't accounted for in my logs
> with log_checkpoints enabled.
>
> After some searching, I found that it was the idle checkpoints that
> weren't being logged. I think this is a missed trick in 6ef2eba3f57.
>
> Attached is a one-liner fix. I realize how imminent we are from
> releasing v10 but I hope there is still time for such a minor issue as this.

> diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
> index dd028a12a4..75f6bd4cc1 100644
> --- a/src/backend/access/transam/xlog.c
> +++ b/src/backend/access/transam/xlog.c
> @@ -8724,7 +8724,7 @@ CreateCheckPoint(int flags)
> WALInsertLockRelease();
> LWLockRelease(CheckpointLock);
> END_CRIT_SECTION();
> - ereport(DEBUG1,
> + ereport(log_checkpoints ? LOG : DEBUG1,
> (errmsg("checkpoint skipped because system is idle")));
> return;
> }

I'd be ok with applying this now, or in 10.1 - but I do think we should
fix this before 11. If nobody protests I'll push later today, so we can
get some bf cycles for the very remote case that this causes problems.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-10-01 22:39:18 Re: Logging idle checkpoints
Previous Message Daniel Gustafsson 2017-10-01 22:25:48 Re: Statement-level rollback