Re: pg_recvlogical prints bogus error when interrupted - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_recvlogical prints bogus error when interrupted
Date
Msg-id ZLdLHVh/jIBmaXq1@paquier.xyz
Whole thread Raw
In response to Re: pg_recvlogical prints bogus error when interrupted  (Michael Paquier <michael@paquier.xyz>)
Responses Re: pg_recvlogical prints bogus error when interrupted
List pgsql-hackers
On Mon, Jul 10, 2023 at 01:44:45PM +0900, Michael Paquier wrote:
> As StreamLogicalLog() states once it leaves its main loop because
> time_to_abort has been switched to true, we want a clean exit.  I
> think that this patch is just a more complicated way to avoid doing
> twice the operations done by prepareToTerminate().  So how about
> moving the prepareToTerminate() call outside the main streaming loop
> and call it when time_to_abort is true?  Then, I would suggest to
> change the keepalive argument of prepareToTerminate() to an enum able
> to handle three values to log the reason why the tool is stopping: the
> end of WAL, an interruption or a keepalive when logging.  There are
> two of them now, but we want a third mode for the signals.

It took me some time to come back to this one, but attached is what I
had in mind.  This stuff has three reasons to stop: keepalive, end LSN
or signal.  This makes the code easier to follow.

Thoughts or comments?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Extension Enhancement: Buffer Invalidation in pg_buffercache
Next
From: mao zhang
Date:
Subject: FATAL: operator class "xxxx" does not exist for access method "btree"