initdb: Improve --wal-segsize handling
Give separate error messages for when the argument is not a number and when it is not the right kind of number. Fix wording in the help message.
This commit is contained in:
parent
4644a1170f
commit
496d56670a
|
@ -2323,7 +2323,7 @@ usage(const char *progname)
|
||||||
printf(_(" -U, --username=NAME database superuser name\n"));
|
printf(_(" -U, --username=NAME database superuser name\n"));
|
||||||
printf(_(" -W, --pwprompt prompt for a password for the new superuser\n"));
|
printf(_(" -W, --pwprompt prompt for a password for the new superuser\n"));
|
||||||
printf(_(" -X, --waldir=WALDIR location for the write-ahead log directory\n"));
|
printf(_(" -X, --waldir=WALDIR location for the write-ahead log directory\n"));
|
||||||
printf(_(" --wal-segsize=SIZE size of wal segment size in megabytes\n"));
|
printf(_(" --wal-segsize=SIZE size of WAL segments, in megabytes\n"));
|
||||||
printf(_("\nLess commonly used options:\n"));
|
printf(_("\nLess commonly used options:\n"));
|
||||||
printf(_(" -d, --debug generate lots of debugging output\n"));
|
printf(_(" -d, --debug generate lots of debugging output\n"));
|
||||||
printf(_(" -k, --data-checksums use data page checksums\n"));
|
printf(_(" -k, --data-checksums use data page checksums\n"));
|
||||||
|
@ -3224,11 +3224,17 @@ main(int argc, char *argv[])
|
||||||
wal_segment_size_mb = strtol(str_wal_segment_size_mb, &endptr, 10);
|
wal_segment_size_mb = strtol(str_wal_segment_size_mb, &endptr, 10);
|
||||||
|
|
||||||
/* verify that wal segment size is valid */
|
/* verify that wal segment size is valid */
|
||||||
if (*endptr != '\0' ||
|
if (*endptr != '\0')
|
||||||
!IsValidWalSegSize(wal_segment_size_mb * 1024 * 1024))
|
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("%s: --wal-segsize must be a power of two between 1 and 1024\n"),
|
_("%s: argument of --wal-segsize must be a number\n"),
|
||||||
|
progname);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!IsValidWalSegSize(wal_segment_size_mb * 1024 * 1024))
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
_("%s: argument of --wal-segsize must be a power of two between 1 and 1024\n"),
|
||||||
progname);
|
progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue