Re: Fix standby logical slot creation during dynamic logical decoding activation

From: Zhijie Hou <houzhijie22(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix standby logical slot creation during dynamic logical decoding activation
Date: 2026-11-24 03:04:20
Message-ID: 4b2b87eb-37c4-4735-bf53-b60f6a2f5115@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Nov24, 2026 at 03:24 AM Masahiko Sawada wrote:
> On Sat, Nov 21, 2026 at 9:09 AM Zhijie Hou <houzhijie22(at)gmail(dot)com> wrote:
>
> > Attached is a patch to fix this by Holding
> > LogicalDecodingControlLock in
> > UpdateLogicalDecodingStatusEndOfRecovery() until the status-change
> > record is written and recording its end LSN in
> > last_replayed_enable_lsn when enabling logical decoding (alongside
> > EnableLogicalDecoding() during replay), and clamping the reserved
> > restart_lsn in ReplicationSlotReserveWal() to at least
> > GetLogicalDecodingEnabledLSN() during recovery.
>
> The patch looks good to me.
>
> > And I kept the field name last_replayed_enable_lsn to keep diff
> > minimal, though we could rename it (e.g., to last_enable_lsn) if
> > others prefer since it now also records an end-of-recovery LSN.
>
> I prefer to rename it to last_enable_lsn. The record written at the
> end of recovery is never replayed on that server, so "replayed"
> doesn't fit anymore.

Thanks for the comments. Here is updated patch that renamed this.

--
Best Regards,
Zhijie Hou

Attachment Content-Type Size
v2-0001-Fix-standby-logical-slot-creation-while-enabling-.patch text/plain 12.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou 2026-11-24 03:11:56 Re: Fix LogStandbySnapshot() race during logical decoding activation
Previous Message Chao Li 2026-11-24 02:40:26 Re: simplehash: Undefine SH_RAW_ALLOCATOR after inclusion