Re: Inactive physical replication slot can bypass synchronized_standby_slots confirmation

From: Zhijie Hou <houzhijie22(at)gmail(dot)com>
To: wangyang25(at)otcaix(dot)iscas(dot)ac(dot)cn, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Inactive physical replication slot can bypass synchronized_standby_slots confirmation
Date: 2026-11-25 02:28:18
Message-ID: f31a1c75-10e6-4bc6-b812-88ab95f4310f@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Mon, Nov23, 2026 at 05:41 PM wangyang25(at)otcaix(dot)iscas(dot)ac(dot)cn wrote:
>
> Summary
>
> An inactive physical replication slot can satisfy synchronized_standby_slots using its initial restart_lsn, even when no standby has connected or confirmed receipt of WAL. A failover logical slot can then return and consume changes before the physical standby has confirmed them.
>

This is as expected. If a standby has already confirmed WAL flush up to
restart_lsn and then disconnects, it already has those changes on disk,
so logical decoding should not wait for WAL at or before restart_lsn.
Requiring the slot to be active here would also break clean primary
shutdown if the physical walsender exits before the logical walsender
checks the slot.

In your test, pg_create_physical_replication_slot('report_phys', true)
sets restart_lsn to the latest checkpoint's redo LSN to reserve WAL for
a subsequent base backup. Any standby built from a base backup taken
afterward will already contain the earlier INSERT, while any WAL
generated after restart_lsn will still wait for standby confirmation. So
I don't think this is a bug.

--
Best Regards,
Zhijie Hou

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-11-25 04:38:42 RE: BUG #18754: Logical replication cannot restart if client sent a copyDone
Previous Message Zsolt Parragi 2026-11-24 22:44:05 Re: BUG #19897: Recovery fails after "LOG: consistent recovery state reached"