From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Should we say "wal_level = logical" instead of "wal_level >= logical" |
Date: | 2025-10-16 00:05:58 |
Message-ID: | CAHut+PtSdpz1PNuUmHmH6U3CJ6ZipkkAssAEf4qnOpi-9cuweQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Hackers,
While reviewing another LR thread [1] it saw multiple wal_level
messages that seem more complex than necessary.
Background: There are three wal_level values [2], ranked as:
minimal < replica < logical
Notice there is no wal_level "above" logical. Despite this, there are
a number of places in the code and messages that say >= logical
instead of just = logical. Here is a list:
heapam.c
- * This is only used in wal_level >= WAL_LEVEL_LOGICAL, and only for catalog
xlog.c
- * This returns true if wal_level >= logical and we are inside a valid
tablecmds.c
- /* should only get here if wal_level >= logical */
slot.c
- appendStringInfoString(&err_detail, _("Logical decoding on standby
requires \"wal_level\" >= \"logical\" on the primary server."));
decode.c
- errmsg("logical decoding on standby requires \"wal_level\" >=
\"logical\" on the primary")));
logical.c
- errmsg("logical decoding requires \"wal_level\" >= \"logical\"")));
- errmsg("logical decoding on standby requires \"wal_level\" >=
\"logical\" on the primary")));
slotsync.c
- * Logical slot sync/creation requires wal_level >= logical.
- errmsg("replication slot synchronization requires \"wal_level\" >=
\"logical\""));
standby.c
- if (wal_level >= WAL_LEVEL_LOGICAL && isCatalogRel)
- if (wal_level >= WAL_LEVEL_LOGICAL)
pg_createsubscriber.c
- pg_log_error("publisher requires \"wal_level\" >= \"logical\"");
xlog.h
- #define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL)
035_standby_logical_decoding.pl
- # We are not able to read from the slot as it requires wal_level >=
logical on the primary server
- "logical decoding on standby requires \"wal_level\" >= \"logical\"
on the primary"
~~~
IMO all these error messages appear more complicated than necessary.
Isn't it simpler to say:
"requires \"wal_level\" = \"logical\" ..."
Instead of:
"requires \"wal_level\" >= \"logical\" ..."
~~~
FYI, there is other code that does not account for anything "above"
logical. e.g.
if (wal_level != WAL_LEVEL_LOGICAL)
~~~
I propose to write a patch to change all those user-facing messages.
What about changing the code/comments as well?
Thoughts?
======
[1] https://www.postgresql.org/message-id/CAD21AoAQJ0LuRYuj0g8-uB9Qtns88HK_TVdoa5jmX3ZPBK9gvw%40mail.gmail.com
[2] https://www.postgresql.org/docs/current/runtime-config-wal.html
Kind Regards,
Peter Smith.
Fujitsu Australia
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2025-10-16 00:13:38 | Re: POC: enable logical decoding when wal_level = 'replica' without a server restart |
Previous Message | Chao Li | 2025-10-15 23:52:09 | Re: remove partColsUpdated |