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

From shveta malik
Subject Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Date
Msg-id CAJpy0uAK1DhVRQm3xufcgncF47ha5hY0AonojiWXunzZSxN-vg@mail.gmail.com
Whole thread Raw
In response to Re: POC: enable logical decoding when wal_level = 'replica' without a server restart  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
List pgsql-hackers
On Thu, Oct 9, 2025 at 4:14 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> Thank you for the comments.
>
> I've attached the updated patch. As we discussed, it now uses the lazy
> deactivation in all cases and has the discussed points in the comments
> atop logicalctl.c.
>

Thank You for making the changes. I am in the process of verifying the
patch. Please find one concern.

When I promote a standby, there's a brief period during
recovery-completion when status_change_allowed is set to true and also
RecoveryInProgress() is still true. If I try to create a logical
replication slot on the standby during this window, it fails with the
following error:

postgres=# SELECT pg_create_logical_replication_slot('slot1',
'pgoutput', false, false, false);
ERROR:  logical decoding on standby requires "effective_wal_level" >=
"logical" on the primary
HINT:  To enable logical decoding, set "wal_level" >= "logical" or
create at least one logical slot when "wal_level" = "replica".

Note that the primary already has logical slots. This issue occurs
because logical decoding is disabled by
UpdateLogicalDecodingStatusEndOfRecovery() due to no existing slots on
standby while RecoveryInProgress() is still true. Should
CheckLogicalDecodingRequirements() also consider
'status_change_allowed' on standby to handle this transition more
gracefully?

thanks
Shveta



pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: speedup COPY TO for partitioned table.
Next
From: Chao Li
Date:
Subject: Re: new environment variable INITDB_LOCALE_PROVIDER