pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix pg_recvlogical upon signal termination
Date: Thu, 20 Jul 2023 01:24:21 +0000
Message-ID: <E1qMIOy-000Mgn-1e@gemulon.postgresql.org> (raw)

Fix pg_recvlogical upon signal termination

When pg_recvlogical needs to abort on a signal like SIGINT/SIGTERM, it
is expected to exit cleanly as the code documents.  However, the code
forgot to clean up the state of the connection before leaving.  This
would cause the tool to emit messages like "unexpected termination of
replication stream" error, which is meant for really unexpected
termination or a crash.

The code is refactored to apply the same termination abort operations for
signals, end LSN and keepalive cases, registering a "reason" for the
termination with a message printed under --verbose adapted to the reason
used.

This is arguably a bug, but this has been this way since the tool exists
and the signal termination can now become slower depending on the change
being decoded when the signal is received.

Reported-by: Andres Freund
Author: Bharath Rupireddy
Reviewed-by: Andres Freund, Kyotaro Horiguchi, Cary Huang, Michael
Paquier
Discussion: https://postgr.es/m/20221019213953.htdtzikf4f45ywil@awork3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/47556a0013fa64d44add2760577d49cf2eca4cd0

Modified Files
--------------
src/bin/pg_basebackup/pg_recvlogical.c | 55 ++++++++++++++++++++++++++--------
src/tools/pgindent/typedefs.list       |  1 +
2 files changed, 44 insertions(+), 12 deletions(-)



Message-ID: <E1qMIOy-000Mgn-1e@gemulon.postgresql.org>
Permalink:  ../E1qMIOy-000Mgn-1e@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qMIOy-000Mgn-1e@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix pg_recvlogical upon signal termination
  In-Reply-To: <E1qMIOy-000Mgn-1e@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