initdb: Further polishing of --wal-segsize option

Extend documentation.  Improve option parsing in case no argument was
specified.
This commit is contained in:
Peter Eisentraut 2018-03-25 09:17:07 -04:00
parent 3a2cb59887
commit 8ad8d916f9
2 changed files with 16 additions and 10 deletions

View File

@ -316,16 +316,22 @@ PostgreSQL documentation
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--wal-segsize=<replaceable>SEGSIZE</replaceable></option></term> <term><option>--wal-segsize=<replaceable>size</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Set the <firstterm>WAL segment size</firstterm>, in megabytes. This is Set the <firstterm>WAL segment size</firstterm>, in megabytes. This
the size of each individual file in the WAL log. It may be useful is the size of each individual file in the WAL log. The default size
to adjust this size to control the granularity of WAL log shipping. is 16 megabytes. The value must be a power of 2 between 1 and 1024
This option can only be set during initialization, and cannot be (megabytes). This option can only be set during initialization, and
changed later. cannot be changed later.
The default size is 16 megabytes. </para>
The value must be a power of 2 between 1 and 1024 (megabytes).
<para>
It may be useful to adjust this size to control the granularity of
WAL log shipping or archiving. Also, in databases with a high volume
of WAL, the sheer number of WAL files per directory can become a
performance and management problem. Increasing the WAL file size
will reduce the number of WAL files.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -3224,7 +3224,7 @@ 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 == str_wal_segment_size_mb || *endptr != '\0')
{ {
fprintf(stderr, fprintf(stderr,
_("%s: argument of --wal-segsize must be a number\n"), _("%s: argument of --wal-segsize must be a number\n"),
@ -3234,7 +3234,7 @@ main(int argc, char *argv[])
if (!IsValidWalSegSize(wal_segment_size_mb * 1024 * 1024)) if (!IsValidWalSegSize(wal_segment_size_mb * 1024 * 1024))
{ {
fprintf(stderr, fprintf(stderr,
_("%s: argument of --wal-segsize must be a power of two between 1 and 1024\n"), _("%s: argument of --wal-segsize must be a power of 2 between 1 and 1024\n"),
progname); progname);
exit(1); exit(1);
} }