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