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-17 01:42:34
Message-ID: OS7PR01MB183177C35E89940B6E72B8C69F57B2@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

> That holds for the apply worker, which exits after ending the stream.
> The walsender itself goes back to command mode once both sides have
> sent CopyDone, as the protocol docs describe, and tablesync relies on
> that: it ends streaming and then drops its slot over the same
> connection.

To confirm, even the tablesync worker does not send the START_REPLICATION
replication message again, right?

> It isn't. With only streamingDoneReceiving reset, the second stream
> delivers data, but when the client sends CopyDone the server doesn't
> send its own, because ProcessRepliesIfAny() only does that while
> streamingDoneSending is false. The attached patch resets both flags
> in StartLogicalReplication(), like StartReplication() does.

The fix looks enough, but the main concern is nobody in core can ensure
re-entering the streaming mode can work well.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ayush Tiwari 2026-11-17 01:45:04 Re: BUG #19906: Backend crash (signal 11) creating a LANGUAGE sql function that returns a composite type from a sub-
Previous Message shihao zhong 2026-11-17 00:55:31 Re: BUG #19899: PL/Python backend crashes (SIGSEGV) when converting a column value to a Python object fails