From 36e4419d1f1ef06bba58a28a870aaaa8de73bb46 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 28 Aug 2023 15:15:20 +0200 Subject: Make error messages about WAL segment size more consistent Make the primary messages more compact and make the detail messages uniform. In initdb.c and pg_resetwal.c, use the newish option_parse_int() to simplify some of the option parsing. For the backend GUC wal_segment_size, add a GUC check hook to do the verification instead of coding it in bootstrap.c. This might be overkill, but that way the check is in the right place and it becomes more self-documenting. In passing, make pg_controldata use the logging API for warning messages. Reviewed-by: Aleksander Alekseev Discussion: https://www.postgresql.org/message-id/flat/9939aa8a-d7be-da2c-7715-0a0b5535a1f7@eisentraut.org --- src/backend/bootstrap/bootstrap.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/backend/bootstrap/bootstrap.c') diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 4cc2efa95c4..5810f8825e9 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -280,16 +280,7 @@ BootstrapModeMain(int argc, char *argv[], bool check_only) strlcpy(OutputFileName, optarg, MAXPGPATH); break; case 'X': - { - int WalSegSz = strtoul(optarg, NULL, 0); - - if (!IsValidWalSegSize(WalSegSz)) - ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("-X requires a power of two value between 1 MB and 1 GB"))); - SetConfigOption("wal_segment_size", optarg, PGC_INTERNAL, - PGC_S_DYNAMIC_DEFAULT); - } + SetConfigOption("wal_segment_size", optarg, PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); break; default: write_stderr("Try \"%s --help\" for more information.\n", -- cgit v1.2.3