RE: BUG #18754: Logical replication cannot restart if client sent a copyDone

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Kacper Kuras' <kacperkuras(at)hotmail(dot)com>
Cc: "ua(dot)san(dot)alex(at)gmail(dot)com" <ua(dot)san(dot)alex(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: RE: BUG #18754: Logical replication cannot restart if client sent a copyDone
Date: 2026-11-25 04:38:42
Message-ID: OS7PR01MB1831792ED3C1C38CFB897B762F5432@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

> Right. Tablesync only relies on the walsender returning to command
> mode: it starts streaming once, to catch up, and after the CopyDone
> exchange it drops its slot on that connection and exits.

It's same as my understanding.

> In core,
> streaming is started again on the same connection only for physical
> replication: walreceiver and pg_receivewal do it when the server ends
> the stream at a timeline switch, and StartReplication() resets the
> flags for them.

Yeah. Per my check abfd192b1 allowed to resume the streaming.

> > The fix looks enough, but the main concern is nobody in core can ensure
> > re-entering the streaming mode can work well.
>
> The test in the patch covers what is specific to a second stream: it
> starts logical streaming again after a logical and after a physical
> stream on the same connection, and checks that the new changes arrive
> and that the server answers CopyDone. Beyond that, a second stream
> runs the same code as the first one, which the existing tests cover,
> so what could break it is state left over from the earlier stream.

Sorry for missing words. My point was that functionalities in core do not re-enter
the streaming mode. Your test code seems to do that, but it looks bit difficult
to put in core (raw_connect() has been used only for testing SSL negotiation so far).
It might be a good timing if build-in logical replication and/or pg_receivelogical
extends to support the usage.

Overall, I'm feeling this is a not a bug fix bug a feature proposal, and stronger
reasoning might be required.

How about others?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message shveta malik 2026-11-25 04:38:57 Re: Inactive physical replication slot can bypass synchronized_standby_slots confirmation
Previous Message Zhijie Hou 2026-11-25 02:28:18 Re: Inactive physical replication slot can bypass synchronized_standby_slots confirmation