Re: Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication
Date
Msg-id CAHGQGwG5H2c4TRk68f2D06kB=F=Z9kr2JdUGwdpg65MrWgAYVQ@mail.gmail.com
Whole thread Raw
In response to Re:Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication  ("Yilin Zhang" <jiezhilove@126.com>)
List pgsql-hackers
On Thu, Dec 4, 2025 at 6:41 PM Yilin Zhang <jiezhilove@126.com> wrote:
>
> On 28/11/2025 02:15, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> > I've made a few minor adjustments to the test patch.
> > The updated version is attached.
>
> Hi,
> I was reading your code and had a question about the new code you added in the main() function of pg_recvlogical.c:
>   if (outfd != -1 && strcmp(outfile, "-") != 0)
>    OutputFsync(feGetCurrentTimestamp());
> In the stream loop, the StreamLogicalLog() function already contains similar code:
>   if (outfd != -1 &&
>    feTimestampDifferenceExceeds(output_last_fsync, now,
>            fsync_interval))
>   {
>    if (!OutputFsync(now))
>     goto error;
>   }
>
> If the outfile becomes unwritable due to external reasons, would the error reporting here be redundant with the error
handlingin StreamLogicalLog()? 

Are you suggesting that the existing code checks the return
value of OutputFsync(), but since it never returns false,
that check is unnecessary and can be removed? If so, I agree.
The attached 0004 patch does that.

Regards,

--
Fujii Masao

Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication
Next
From: Japin Li
Date:
Subject: Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build