Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Shlok Kyal <shlok.kyal.oss@gmail.com>
Cc: shveta malik <shveta.malik@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
Amit Kapila <amit.kapila16@gmail.com>, Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-08-25T19:24:07Z
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 →
-
Fix regression test failure when wal_level is set to minimal.
- 0de5f0d869d1 19 (unreleased) landed
-
Toggle logical decoding dynamically based on logical slot presence.
- 67c20979ce72 19 (unreleased) landed
-
Disallow server start with sync_replication_slots = on and wal_level < logical.
- 12da45742cfd 19 (unreleased) cited
Attachments
- v10-0001-Enable-logical-decoding-dynamically-based-on-log.patch (application/octet-stream) patch v10-0001
On Mon, Aug 25, 2025 at 6:02 AM Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:
>
>
> Hi Sawada-san,
>
> I reviewed the latest patch and have following comments:
>
> 1. In commit message, word 'slot' is missing:
> When the first logical replication is created, the system
> automatically increases the effective WAL level to maintain
>
> Instead it should be:
> When the first logical replication slot is created, ...
Fixed.
>
> 2. In slot.c:
> +/*
> + * Returns if there is at least in-use logical replication slot.
> + */
>
> Should we update it to:
> Returns true if there is at least one in-use logical replication slot.
Fixed.
>
> 3. Due to recent commit [1], we cannot use "sync_replication_slots" =
> on when wal_level < logical.
> We get following error on standby:
> 2025-08-25 16:37:04.757 IST [2901542] FATAL: replication slot
> synchronization ("sync_replication_slots" = on) requires "wal_level"
> >= "logical"
> If we set the wal_level = logical on standby, then this error does not
> appear and a slot sync worker is spawned.
>
> With this patch, I think we can allow use of "sync_replication_slots"
> = on when wal_level >= replica as standby will be dependent on
> effective_wal_level on primary. Thoughts?
> I also see that with patch, the use of pg_sync_replication_slots()
> works with wal_level = replica.
Good point. I agree with you, so fixed.
I've attached the updated patch that incorporated the comments and is
rebased to the current HEAD.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com