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

From Yilin Zhang
Subject Re:Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication
Date
Msg-id 21f78e1a.858b.19ae8bc7b4f.Coremail.jiezhilove@126.com
Whole thread Raw
In response to Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
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 handling in StreamLogicalLog()?

Best regards,
--
Yilin Zhang

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Remove unused function parameters, part 2: replication
Next
From: Maxim Orlov
Date:
Subject: Re: Using MyDatabaseId in SET_LOCKTAG_APPLY_TRANSACTION