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: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: shveta malik <shveta.malik@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-17T03:25:26Z
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
On Thu, Oct 16, 2025 at 11:10 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > On Thu, Oct 16, 2025 at 1:41 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > Using PMSIGNAL_BACKGROUND_WORKER_CHANGE sounds mis-using since the > slotsync worker is not a background worker nor logical decoding > activation is not related to bgworkers. > > An alternative idea is to launch the slotsync worker if wal_level > value on the standby is >=replica, that is, always launch it on the > standby if sync_replication_slots is on. Even with and without the > patch, we don't shutdown the slotsync worker even if logical decoding > gets disabled on the standby. > Are you talking about the case when wal_level on primary has reduced below logical and user will get the following message on standby: "logical decoding on standby requires \"wal_level\" >= \"logical\" on the primary"? If so, the slight difference in this case is that standby still has wal_level logical. > > So it would be okay in principle to keep > the slotsync worker running while wal_level='replica'. A drawback > would be that users always using wal_level='replica' would > unnecessarily launch the slotsync worker but they can turn off > sync_replication_slots GUC parameter. > Right, I would prefer a new PMSIGNAL for this. But OTOH, we are not sure how frequent or important this case is in the field, so maybe it is not worth adding more code for it. However, we should at least add a comment for future optimization. One semi-related point is if one would like to write a regression test for this behaviour, the test timing would be unpredictable. -- With Regards, Amit Kapila.