Re: POC: enable logical decoding when wal_level = 'replica' without a server restart

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: shveta malik <shveta.malik@gmail.com>
Cc: Sawada Masahiko <sawada.mshk@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Shlok Kyal <shlok.kyal.oss@gmail.com>, Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-10-28T10:29:47Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix regression test failure when wal_level is set to minimal.

  2. Toggle logical decoding dynamically based on logical slot presence.

  3. Disallow server start with sync_replication_slots = on and wal_level < logical.

On Mon, Oct 27, 2025 at 8:38 PM shveta malik <shveta.malik@gmail.com> wrote:
>
> On Mon, Oct 27, 2025 at 6:12 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
>
> > Another related point is that, say we decide to disable decoding
> > because the last logical slot got invalidated and
> > RequestDisableLogicalDecoding()->LogicalDecodingStatusChangeAllowed()
> > returns false, then how the disabling will happen?
> >
>
> If LogicalDecodingStatusChangeAllowed() returns false, we do not
> disable logical decoding because that essentially means
> recovery-in-progress and if that is the case, we do not allow
> status-change. LogicalDecodingStatusChangeAllowed() returns false
> always on standby until it is promoted and recovery ends.
>

But the request will be lost and we won't be able to disable decoding
after promotion. Won't it be better if RequestDisableLogicalDecoding()
always set pending_disable as true and later
checkpointer->DisableLogicalDecodingIfNecessary() anyway takes care of
it by calling LogicalDecodingStatusChangeAllowed()? That way the
request to disable decoding won't be lost.

-- 
With Regards,
Amit Kapila.