pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix checkpoint signalling
Date: Wed, 29 Apr 2020 22:47:32 +0000
Message-ID: <E1jTvUK-0004oQ-80@gemulon.postgresql.org> (raw)

Fix checkpoint signalling

Checkpointer uses its MyLatch to wake up when a checkpoint request is
received.  But before commit c6550776394e the latch was not used for
anything else, so the code could just go to sleep after each loop
without rechecking the sleeping condition.  That commit added a separate
ResetLatch in its code path[1], which can cause a checkpoint to go
unnoticed for potentially a long time.

Fix by skipping sleep if any checkpoint flags are set.  Also add a test
to verify this; authored by Kyotaro Horiguchi.

[1] CreateCheckPoint -> InvalidateObsoleteReplicationSlots ->
ConditionVariableTimeSleep

Report and diagnosis by Kyotaro Horiguchi.
Co-authored-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/20200408.141956.891237856186513376.horikyota.ntt@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1816a1c6ffe46782eee9a16a974b4aa3f4b8457b

Modified Files
--------------
src/backend/postmaster/checkpointer.c     |  7 +++++
src/test/recovery/t/019_replslot_limit.pl | 44 +++++++++++++++++++++++++++++--
2 files changed, 49 insertions(+), 2 deletions(-)



Message-ID: <E1jTvUK-0004oQ-80@gemulon.postgresql.org>
Permalink:  ../E1jTvUK-0004oQ-80@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jTvUK-0004oQ-80@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Fix checkpoint signalling
  In-Reply-To: <E1jTvUK-0004oQ-80@gemulon.postgresql.org>
  References: <E1jTvUK-0004oQ-80@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox