Fix documentation for max_wal_size and min_wal_size

Started by sirisha chamarthialmost 3 years ago9 messages
#1sirisha chamarthi
sirichamarthi22@gmail.com
1 attachment(s)

Hi,

The documentation [1]https://www.postgresql.org/docs/devel/runtime-config-wal.html says max_wal_size and min_wal_size defaults are 1GB
and 80 MB respectively. However, these are configured based on the
wal_segment_size and documentation is not clear about it. Attached a patch
to fix the documentation.

[1]: https://www.postgresql.org/docs/devel/runtime-config-wal.html

Thanks,
Sirisha

Attachments:

0001-Fix-documentation-for-max_wal_size-and-min_wal_size-.patchapplication/octet-stream; name=0001-Fix-documentation-for-max_wal_size-and-min_wal_size-.patchDownload
From 8d740a34a626842ec9e89a0289c5a35f3847ad48 Mon Sep 17 00:00:00 2001
From: root <root@pgvm.rlsumirojk0etd4qpjbaa2afce.tx.internal.cloudapp.net>
Date: Thu, 13 Apr 2023 18:46:55 +0000
Subject: [PATCH] Fix documentation for max_wal_size and min_wal_size default
 size

---
 doc/src/sgml/config.sgml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index f81c2045ec..9f2b9b5580 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -3589,7 +3589,7 @@ include_dir 'conf.d'
         heavy load, a failing <varname>archive_command</varname> or <varname>archive_library</varname>, or a high
         <varname>wal_keep_size</varname> setting.
         If this value is specified without units, it is taken as megabytes.
-        The default is 1 GB.
+        The default value is configured to maximum of 64 times the <varname>wal_segment_size</varname> or 1 GB.
         Increasing this parameter can increase the amount of time needed for
         crash recovery.
         This parameter can only be set in the <filename>postgresql.conf</filename>
@@ -3612,7 +3612,7 @@ include_dir 'conf.d'
         handle spikes in WAL usage, for example when running large batch
         jobs.
         If this value is specified without units, it is taken as megabytes.
-        The default is 80 MB.
+        The default value is configured to maximum of 5 times the <varname>wal_segment_size</varname> or 80 MB.
         This parameter can only be set in the <filename>postgresql.conf</filename>
         file or on the server command line.
        </para>
-- 
2.25.1

#2Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: sirisha chamarthi (#1)
Re: Fix documentation for max_wal_size and min_wal_size

At Thu, 13 Apr 2023 12:01:04 -0700, sirisha chamarthi <sirichamarthi22@gmail.com> wrote in

The documentation [1] says max_wal_size and min_wal_size defaults are 1GB
and 80 MB respectively. However, these are configured based on the
wal_segment_size and documentation is not clear about it. Attached a patch
to fix the documentation.

[1] https://www.postgresql.org/docs/devel/runtime-config-wal.html

Good catch! Now wal_segment_size is easily changed.

-        The default is 1 GB.
+        The default value is configured to maximum of 64 times the <varname>wal_segment_size</varname> or 1 GB.
-        The default is 80 MB.
+        The default value is configured to maximum of 5 times the <varname>wal_segment_size</varname> or 80 MB.

However, I believe that most users don't change the WAL segment size,
so the primary information is that the default sizes are 1GB and 80MB.

So, I personally think it should be written like this: "The default
size is 80MB. However, if you have changed the WAL segment size from
the default of 16MB, it will be five times the segment size.", but I'm
not sure what the others think about this..

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

#3sirisha chamarthi
sirichamarthi22@gmail.com
In reply to: Kyotaro Horiguchi (#2)
Re: Fix documentation for max_wal_size and min_wal_size

Hi,

On Fri, Apr 14, 2023 at 1:01 AM Kyotaro Horiguchi <horikyota.ntt@gmail.com>
wrote:

At Thu, 13 Apr 2023 12:01:04 -0700, sirisha chamarthi <
sirichamarthi22@gmail.com> wrote in

The documentation [1] says max_wal_size and min_wal_size defaults are 1GB
and 80 MB respectively. However, these are configured based on the
wal_segment_size and documentation is not clear about it. Attached a

patch

to fix the documentation.

[1] https://www.postgresql.org/docs/devel/runtime-config-wal.html

Good catch! Now wal_segment_size is easily changed.

-        The default is 1 GB.
+        The default value is configured to maximum of 64 times the
<varname>wal_segment_size</varname> or 1 GB.
-        The default is 80 MB.
+        The default value is configured to maximum of 5 times the
<varname>wal_segment_size</varname> or 80 MB.

However, I believe that most users don't change the WAL segment size,
so the primary information is that the default sizes are 1GB and 80MB.

So, I personally think it should be written like this: "The default
size is 80MB. However, if you have changed the WAL segment size from
the default of 16MB, it will be five times the segment size.", but I'm
not sure what the others think about this..

This looks good to me.

Thanks,
Sirisha

#4Michael Paquier
michael@paquier.xyz
In reply to: sirisha chamarthi (#3)
Re: Fix documentation for max_wal_size and min_wal_size

On Mon, Apr 17, 2023 at 07:57:58PM -0700, sirisha chamarthi wrote:

On Fri, Apr 14, 2023 at 1:01 AM Kyotaro Horiguchi <horikyota.ntt@gmail.com>
wrote:

So, I personally think it should be written like this: "The default
size is 80MB. However, if you have changed the WAL segment size from
the default of 16MB, it will be five times the segment size.", but I'm
not sure what the others think about this..

Yes, I was under the impression that this should mention 16MB, but
I'd also add a note about initdb when a non-default value is specified
for the segment size.
--
Michael

#5sirisha chamarthi
sirichamarthi22@gmail.com
In reply to: Michael Paquier (#4)
Re: Fix documentation for max_wal_size and min_wal_size

Hi

On Mon, Apr 17, 2023 at 9:38 PM Michael Paquier <michael@paquier.xyz> wrote:

On Mon, Apr 17, 2023 at 07:57:58PM -0700, sirisha chamarthi wrote:

On Fri, Apr 14, 2023 at 1:01 AM Kyotaro Horiguchi <

horikyota.ntt@gmail.com>

wrote:

So, I personally think it should be written like this: "The default
size is 80MB. However, if you have changed the WAL segment size from
the default of 16MB, it will be five times the segment size.", but I'm
not sure what the others think about this..

Yes, I was under the impression that this should mention 16MB, but
I'd also add a note about initdb when a non-default value is specified
for the segment size.

How about the text below?

"The default size is 80MB. However, if you have changed the WAL segment size
from the default of 16MB with the initdb option --wal-segsize, it will be
five times the segment size."

#6Michael Paquier
michael@paquier.xyz
In reply to: sirisha chamarthi (#5)
Re: Fix documentation for max_wal_size and min_wal_size

On Tue, Apr 18, 2023 at 01:46:21AM -0700, sirisha chamarthi wrote:

"The default size is 80MB. However, if you have changed the WAL segment size
from the default of 16MB with the initdb option --wal-segsize, it will be
five times the segment size."

Yes, I think that something close to that would be OK. Do others have
any comments or extra ideas to offer?
--
Michael

#7Fujii Masao
masao.fujii@oss.nttdata.com
In reply to: Michael Paquier (#6)
Re: Fix documentation for max_wal_size and min_wal_size

On 2023/04/22 17:39, Michael Paquier wrote:

On Tue, Apr 18, 2023 at 01:46:21AM -0700, sirisha chamarthi wrote:

"The default size is 80MB. However, if you have changed the WAL segment size
from the default of 16MB with the initdb option --wal-segsize, it will be
five times the segment size."

Yes, I think that something close to that would be OK. Do others have
any comments or extra ideas to offer?

If the WAL segment size is changed from the default value of 16MB during initdb,
the value of min_wal_size in postgresql.conf is set to five times the new segment
size by initdb. However, pg_settings.boot_val (the value of min_wal_size used
when the parameter is not otherwise set) is still 80MB. So if pg_settings.boot_val
should be documented as the default value, the current description seems OK.

Or we can clarify that the default value of min_wal_size is 80MB, but when initdb
is run with a non-default segment size, the value in postgresql.conf is changed
to five times the new segment size? This will help users better understand
the behavior of the setting and how it is affected by changes made during initdb.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

#8Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Fujii Masao (#7)
Re: Fix documentation for max_wal_size and min_wal_size

At Sat, 22 Apr 2023 18:52:27 +0900, Fujii Masao <masao.fujii@oss.nttdata.com> wrote in

If the WAL segment size is changed from the default value of 16MB
during initdb,
the value of min_wal_size in postgresql.conf is set to five times the
new segment
size by initdb. However, pg_settings.boot_val (the value of
min_wal_size used
when the parameter is not otherwise set) is still 80MB. So if
pg_settings.boot_val
should be documented as the default value, the current description
seems OK.

Hmm, things are a bit more complex than I initially thought. The value is actually set in the configuration file, but the lines are added by initdb. The documentation states the following.

https://www.postgresql.org/docs/devel/view-pg-settings.html

boot_val text
Parameter value assumed at server startup if the parameter is not
otherwise set

So, the description is accurate as it stands. If I remove the lines, they will revert to the default values.

Or we can clarify that the default value of min_wal_size is 80MB, but
when initdb
is run with a non-default segment size, the value in postgresql.conf
is changed
to five times the new segment size? This will help users better
understand
the behavior of the setting and how it is affected by changes made
during initdb.

So, to clarify the situation, I would phrase it like this:

The default size is 80MB. Note that if you have changed the WAL
segment size from the default of 16MB with the initdb option
--wal-segsize, the tool should have added the settings with the values
equal to five times the specified segment size to the configuration
file.

It might be a bit wordy, though..

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

#9Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Kyotaro Horiguchi (#8)
Re: Fix documentation for max_wal_size and min_wal_size

At Mon, 24 Apr 2023 10:57:56 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in

So, to clarify the situation, I would phrase it like this:

The default size is 80MB. Note that if you have changed the WAL
segment size from the default of 16MB with the initdb option
--wal-segsize, the tool should have added the settings with the values
equal to five times the specified segment size to the configuration
file.

It might be a bit wordy, though..

Or would the following work?

The default size is 80MB. Note that initdb may have added the setting
for this value if you have specified the WAL segment size when running
the tool.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center