Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
shveta malik <shveta.malik@gmail.com>
From: shveta malik <shveta.malik@gmail.com>
To: Peter Smith <smithpb2250@gmail.com>,
Sawada Masahiko <sawada.mshk@gmail.com>
Cc: Amit Kapila <amit.kapila16@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>,
shveta malik <shveta.malik@gmail.com>
Date: 2025-10-27T11:21:20Z
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 Mon, Oct 27, 2025 at 6:24 AM Peter Smith <smithpb2250@gmail.com> wrote:
>
> Hi Sawada.
>
> A couple of comments for v22-0001.
>
> ======
>
> 1.
> + /*
> + * We don't need this warning message when wal_level >= 'replica' since
> + * logical decoding is automatically enabled up on a logical slot
> + * creation.
> + */
> + if (wal_level == WAL_LEVEL_MINIMAL)
> ereport(WARNING,
> (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> - errmsg("\"wal_level\" is insufficient to publish logical changes"),
> - errhint("Set \"wal_level\" to \"logical\" before creating subscriptions.")));
> + errmsg("logical decoding must be enabled to publish logical changes"),
> + errhint("Before creating subscriptions, set \"wal_level\" >=
> \"logical\" or create a logical replication slot when \"wal_level\" =
> \"replica\".")));
>
> 1a.
> Sorry, for repeating the same question about the HINT message, but
> AFAICT I did not yet notice any reply to directly reject or address my
> question.
>
> Basically, I felt the errhint part that says "...or create a logical
> replication slot when wal_level = replica." is overkill, because
> creating the subscription will do that anyway.
> In other words, we don't need to tell the user this is needed "Before
> creating subscriptions". So, I thought the only requirement to be able
> to publish a subscription is for wal_level >= replica.
>
> SUGGESTION
> errhint("Before creating subscriptions, set \"wal_level\" >= \"replica\".")
>
While verifying the patch, I too noticed this case. On latest patch,
with wal_level=minimal, CREATE PUBLICATION gives this:
postgres=# create publication pub1;
WARNING: logical decoding must be enabled to publish logical changes
HINT: Before creating subscriptions, set "wal_level" >= "logical" or
create a logical replication slot when "wal_level" = "replica".
I don’t have a strong opinion on this, but I’m slightly inclined
toward Peter’s suggestion on HINT.
thanks
Shveta