The error reported when the publisher has wal_level = minimal says what
is required but not how to fix it.  The neighboring errors about
max_replication_slots and max_wal_senders already carry a hint.  Add one
here, using the wording of the equivalent hint in slot.c.
---
Hi,

I may have missed something, so please correct me where I am wrong.

When the publisher has wal_level = minimal, pg_createsubscriber says what is 
required but not how to fix it:

  pg_createsubscriber: error: publisher requires "wal_level" >= "replica"

The next checks in check_publisher(), for max_replication_slots and 
max_wal_senders, already print a hint. The attached patch adds a hint here, 
with the same wording as the errhint in slot.c:

  pg_createsubscriber: hint: Change "wal_level" to be "replica" or higher.

I tested on current master (8303f2e) with --enable-cassert and 
--enable-tap-tests. I ran pg_createsubscriber --dry-run against a primary with 
wal_level=minimal. The hint appears after the patch and not before. "make 
check" in src/bin/pg_basebackup passed (362 tests, including 
040_pg_createsubscriber), and pgindent shows no diff.

What I did not test: translations (--enable-nls), meson, other platforms, and 
whether this was already discussed on the list. I did not add a regression 
test, because I found no existing test that checks this message.

Does this make sense? If the hint is redundant or the wording should change, I 
am happy to adjust or drop the patch.

Thank you for your time.
 src/bin/pg_basebackup/pg_createsubscriber.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c 
b/src/bin/pg_basebackup/pg_createsubscriber.c
index 20b354a..8a84bcf 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -1092,6 +1092,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
        if (strcmp(wal_level, "minimal") == 0)
        {
                pg_log_error("publisher requires \"wal_level\" >= \"replica\"");
+               pg_log_error_hint("Change \"wal_level\" to be \"replica\" or 
higher.");
                failed = true;
        }
 
-- 
2.39.5



Reply via email to