Re: POC: enable logical decoding when wal_level = 'replica' without a server restart - Mailing list pgsql-hackers

From Masahiko Sawada
Subject Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Date
Msg-id CAD21AoB0FehvR2GM5bTATQ+axYzit8zB0AiZ-EYSY=pTnfCstg@mail.gmail.com
Whole thread Raw
In response to Re: POC: enable logical decoding when wal_level = 'replica' without a server restart  (shveta malik <shveta.malik@gmail.com>)
Responses Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
List pgsql-hackers
On Thu, Nov 27, 2025 at 3:51 AM shveta malik <shveta.malik@gmail.com> wrote:
>
> On Thu, Nov 27, 2025 at 2:32 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
> >
> >
> > I've squashed all fixup patches and attached the updated patch.
> >
>
> Thanks for test results and the patch. Please find a few comments:
>
> 1)
> If primary has effective_wal_level as logical and standby has zero
> slots; then during promotion of standby, if I try to create a slot, it
> is restricted as intended, but it gives misleading message:
> postgres=# SELECT pg_create_logical_replication_slot('slot',
> 'pgoutput', false, false, false);
> ERROR:  logical decoding on standby requires "effective_wal_level" >=
> "logical" on the primary
> HINT:  Set "wal_level" >= "logical" or create at least one logical
> slot when "wal_level" = "replica".
>
> One possibility is we extend the message as follows:
> "Logical decoding on standby requires either effective_wal_level >=
> logical on the primary or that recovery has finished." and remove
> errhint?

But the proposed message seems to contradict with its condition:

if (RecoveryInProgress() && !IsLogicalDecodingEnabled())

That is, logical decoding on standby is not necessarily enabled after
recovery has finished (e.g., when it doesn't have a valid logical
slot).

If you get the error message while the standby is being promoted,
isn't it a normal behavior given that the standby has not been fully
promoted yet?


I've addressed other points in the next version patch.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Next
From: Junwang Zhao
Date:
Subject: Re: Eliminating SPI / SQL from some RI triggers - take 3