Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8ad8d91

Browse files
committed
initdb: Further polishing of --wal-segsize option
Extend documentation. Improve option parsing in case no argument was specified.
1 parent 3a2cb59 commit 8ad8d91

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

doc/src/sgml/ref/initdb.sgml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,22 @@ PostgreSQL documentation
316316
</varlistentry>
317317

318318
<varlistentry>
319-
<term><option>--wal-segsize=<replaceable>SEGSIZE</replaceable></option></term>
319+
<term><option>--wal-segsize=<replaceable>size</replaceable></option></term>
320320
<listitem>
321321
<para>
322-
Set the <firstterm>WAL segment size</firstterm>, in megabytes. This is
323-
the size of each individual file in the WAL log. It may be useful
324-
to adjust this size to control the granularity of WAL log shipping.
325-
This option can only be set during initialization, and cannot be
326-
changed later.
327-
The default size is 16 megabytes.
328-
The value must be a power of 2 between 1 and 1024 (megabytes).
322+
Set the <firstterm>WAL segment size</firstterm>, in megabytes. This
323+
is the size of each individual file in the WAL log. The default size
324+
is 16 megabytes. The value must be a power of 2 between 1 and 1024
325+
(megabytes). This option can only be set during initialization, and
326+
cannot be changed later.
327+
</para>
328+
329+
<para>
330+
It may be useful to adjust this size to control the granularity of
331+
WAL log shipping or archiving. Also, in databases with a high volume
332+
of WAL, the sheer number of WAL files per directory can become a
333+
performance and management problem. Increasing the WAL file size
334+
will reduce the number of WAL files.
329335
</para>
330336
</listitem>
331337
</varlistentry>

src/bin/initdb/initdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3224,7 +3224,7 @@ main(int argc, char *argv[])
32243224
wal_segment_size_mb = strtol(str_wal_segment_size_mb, &endptr, 10);
32253225

32263226
/* verify that wal segment size is valid */
3227-
if (*endptr != '\0')
3227+
if (endptr == str_wal_segment_size_mb || *endptr != '\0')
32283228
{
32293229
fprintf(stderr,
32303230
_("%s: argument of --wal-segsize must be a number\n"),
@@ -3234,7 +3234,7 @@ main(int argc, char *argv[])
32343234
if (!IsValidWalSegSize(wal_segment_size_mb * 1024 * 1024))
32353235
{
32363236
fprintf(stderr,
3237-
_("%s: argument of --wal-segsize must be a power of two between 1 and 1024\n"),
3237+
_("%s: argument of --wal-segsize must be a power of 2 between 1 and 1024\n"),
32383238
progname);
32393239
exit(1);
32403240
}

0 commit comments

Comments
 (0)