Re: pg_recvlogical prints bogus error when interrupted

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_recvlogical prints bogus error when interrupted
Date: 2022-10-20 07:58:45
Message-ID: CALj2ACUAd==wVcQxbkhxAmoegs2g_b+OX8moL68NzjtnFeoM4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 20, 2022 at 3:10 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
> While reviewing
> https://postgr.es/m/CAD21AoBe2o2D%3Dxyycsxw2bQOD%3DzPj7ETuJ5VYGN%3DdpoTiCMRJQ%40mail.gmail.com
> I noticed that pg_recvlogical prints
> "pg_recvlogical: error: unexpected termination of replication stream: "
>
> when signalled with SIGINT/TERM.
>
> Oddly enough, that looks to have "always" been the case, even though clearly
> the code tried to make provisions for a different outcome.
>
>
> It looks to me like all that's needed is to gate the block printing the
> message with an !time_to_abort.

+1. How about emitting a message like its friend pg_receivewal, like
the attached patch?

> I also then noticed that we don't fsync the output file in cases of errors -
> that seems wrong to me? Looks to me like that block should be moved till after
> the error:?

How about something like the attached patch?

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v1-0001-pg_recvlogical-fixes.patch application/octet-stream 1.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-10-20 07:59:12 Re: thinko in basic_archive.c
Previous Message Peter Smith 2022-10-20 07:52:00 Re: GUC values - recommended way to declare the C variables?