Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-08-12 Thread Bruce Momjian
On Mon, Jul 18, 2022 at 11:16:15PM -0400, Bruce Momjian wrote:
> On Mon, Jul 18, 2022 at 07:39:55PM -0700, David G. Johnston wrote:
> > On Mon, Jul 18, 2022 at 6:27 PM Japin Li  wrote:
> > 
> > 
> > +0.90
> > 
> > Consider changing:
> > 
> > "makes any base backups taken before this unusable"
> > 
> > to:
> > 
> > "makes existing base backups unusable"
> > 
> > As I try to justify this, though, it isn't quite true, maybe:
> > 
> > "makes point-in-time recovery, using existing base backups, unable to replay
> > future WAL."
> 
> I went with simpler wording.

Patch applied back to PG 14, and partial to PG 13.  Docs before that
were too different to be safe.

-- 
  Bruce Momjian  https://momjian.us
  EDB  https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson





Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-18 Thread David G. Johnston
On Mon, Jul 18, 2022 at 8:16 PM Bruce Momjian  wrote:

> On Mon, Jul 18, 2022 at 07:39:55PM -0700, David G. Johnston wrote:
> > On Mon, Jul 18, 2022 at 6:27 PM Japin Li  wrote:
> >
> >
> > +0.90
> >
> > Consider changing:
> >
> > "makes any base backups taken before this unusable"
> >
> > to:
> >
> > "makes existing base backups unusable"
> >
> > As I try to justify this, though, it isn't quite true, maybe:
> >
> > "makes point-in-time recovery, using existing base backups, unable to
> replay
> > future WAL."
>
> I went with simpler wording.
>
>
+1

Thanks!

David J.


Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-18 Thread Bruce Momjian
On Mon, Jul 18, 2022 at 07:39:55PM -0700, David G. Johnston wrote:
> On Mon, Jul 18, 2022 at 6:27 PM Japin Li  wrote:
> 
> 
> +0.90
> 
> Consider changing:
> 
> "makes any base backups taken before this unusable"
> 
> to:
> 
> "makes existing base backups unusable"
> 
> As I try to justify this, though, it isn't quite true, maybe:
> 
> "makes point-in-time recovery, using existing base backups, unable to replay
> future WAL."

I went with simpler wording.

-- 
  Bruce Momjian  https://momjian.us
  EDB  https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 37fd80388c..c2bdacb6a7 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2764,9 +2764,10 @@ include_dir 'conf.d'
 levels.  This parameter can only be set at server start.


-In minimal level, no information is logged for
-permanent relations for the remainder of a transaction that creates or
-rewrites them.  This can make operations much faster (see
+The minimal level generates the least WAL
+volume.  It logs no row information for permanent relations
+in transactions that create or
+rewrite them.  This can make operations much faster (see
 ).  Operations that initiate this
 optimization include:
 
@@ -2778,19 +2779,20 @@ include_dir 'conf.d'
  REINDEX
  TRUNCATE
 
-But minimal WAL does not contain enough information to reconstruct the
-data from a base backup and the WAL logs, so replica or
-higher must be used to enable WAL archiving
-() and streaming replication.
+However, minimal WAL does not contain sufficient information for
+point-in-time recovery, so replica or
+higher must be used to enable continuous archiving
+() and streaming binary replication.
+In fact, the server will not even start in this mode if
+max_wal_senders is non-zero.
 Note that changing wal_level to
-minimal makes any base backups taken before
-unavailable for archive recovery and standby server, which may
-lead to data loss.
+minimal makes previous base backups unusable
+for point-in-time recovery and standby servers.


 In logical level, the same information is logged as
-with replica, plus information needed to allow
-extracting logical change sets from the WAL. Using a level of
+with replica, plus information needed to
+extract logical change sets from the WAL. Using a level of
 logical will increase the WAL volume, particularly if many
 tables are configured for REPLICA IDENTITY FULL and
 many UPDATE and DELETE statements are


Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-18 Thread David G. Johnston
On Mon, Jul 18, 2022 at 6:27 PM Japin Li  wrote:

>
> On Tue, 19 Jul 2022 at 03:58, Bruce Momjian  wrote:
> > On Fri, Jul 15, 2022 at 09:29:20PM +0800, Japin Li wrote:
> >>
> >> On Fri, 15 Jul 2022 at 08:49, Bruce Momjian  wrote:
> >> > On Tue, Jul  5, 2022 at 08:02:33PM -0400, Tom Lane wrote:
> >> >> "Precondition" is an overly fancy word that makes things less clear
> >> >> not more so.  Does it mean that setting wal_level = minimal will fail
> >> >> if you don't do these other things, or does it just mean that you
> >> >> won't be getting the absolute minimum WAL volume?  If the former,
> >> >> I think it'd be better to say something like "To set wal_level to
> minimal,
> >> >> you must also set [these variables], which has the effect of
> disabling
> >> >> both WAL archiving and streaming replication."
> >> >
> >> > I have created the attached patch to try to improve this text.
> >>
> >> IMO we can add the following sentence for wal_level description, since
> >> if wal_level = minimal and max_wal_senders > 0, we cannot start the
> database.
> >>
> >> To set wal_level to minimal, you must also set max_wal_senders to 0,
> >> which has the effect of disabling both WAL archiving and streaming
> >> replication.
> >
> > Okay, text added in the attached patch.
>
> Thanks for updating the patch! LGTM.
>
>
+0.90

Consider changing:

"makes any base backups taken before this unusable"

to:

"makes existing base backups unusable"

As I try to justify this, though, it isn't quite true, maybe:

"makes point-in-time recovery, using existing base backups, unable to
replay future WAL."

David J.


Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-18 Thread Japin Li


On Tue, 19 Jul 2022 at 03:58, Bruce Momjian  wrote:
> On Fri, Jul 15, 2022 at 09:29:20PM +0800, Japin Li wrote:
>> 
>> On Fri, 15 Jul 2022 at 08:49, Bruce Momjian  wrote:
>> > On Tue, Jul  5, 2022 at 08:02:33PM -0400, Tom Lane wrote:
>> >> "Precondition" is an overly fancy word that makes things less clear
>> >> not more so.  Does it mean that setting wal_level = minimal will fail
>> >> if you don't do these other things, or does it just mean that you
>> >> won't be getting the absolute minimum WAL volume?  If the former,
>> >> I think it'd be better to say something like "To set wal_level to minimal,
>> >> you must also set [these variables], which has the effect of disabling
>> >> both WAL archiving and streaming replication."
>> >
>> > I have created the attached patch to try to improve this text.
>> 
>> IMO we can add the following sentence for wal_level description, since
>> if wal_level = minimal and max_wal_senders > 0, we cannot start the database.
>> 
>> To set wal_level to minimal, you must also set max_wal_senders to 0,
>> which has the effect of disabling both WAL archiving and streaming
>> replication.
>
> Okay, text added in the attached patch.

Thanks for updating the patch! LGTM.

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.




Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-18 Thread Bruce Momjian
On Fri, Jul 15, 2022 at 09:29:20PM +0800, Japin Li wrote:
> 
> On Fri, 15 Jul 2022 at 08:49, Bruce Momjian  wrote:
> > On Tue, Jul  5, 2022 at 08:02:33PM -0400, Tom Lane wrote:
> >> "Precondition" is an overly fancy word that makes things less clear
> >> not more so.  Does it mean that setting wal_level = minimal will fail
> >> if you don't do these other things, or does it just mean that you
> >> won't be getting the absolute minimum WAL volume?  If the former,
> >> I think it'd be better to say something like "To set wal_level to minimal,
> >> you must also set [these variables], which has the effect of disabling
> >> both WAL archiving and streaming replication."
> >
> > I have created the attached patch to try to improve this text.
> 
> IMO we can add the following sentence for wal_level description, since
> if wal_level = minimal and max_wal_senders > 0, we cannot start the database.
> 
> To set wal_level to minimal, you must also set max_wal_senders to 0,
> which has the effect of disabling both WAL archiving and streaming
> replication.

Okay, text added in the attached patch.

-- 
  Bruce Momjian  https://momjian.us
  EDB  https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 37fd80388c..4c0489c9c3 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2764,9 +2764,10 @@ include_dir 'conf.d'
 levels.  This parameter can only be set at server start.


-In minimal level, no information is logged for
-permanent relations for the remainder of a transaction that creates or
-rewrites them.  This can make operations much faster (see
+The minimal level generates the least WAL
+volume.  It logs no row information for permanent relations
+in transactions that create or
+rewrite them.  This can make operations much faster (see
 ).  Operations that initiate this
 optimization include:
 
@@ -2778,19 +2779,20 @@ include_dir 'conf.d'
  REINDEX
  TRUNCATE
 
-But minimal WAL does not contain enough information to reconstruct the
-data from a base backup and the WAL logs, so replica or
-higher must be used to enable WAL archiving
-() and streaming replication.
+However, minimal WAL does not contain sufficient information for
+point-in-time recovery, so replica or
+higher must be used to enable continuous archiving
+() and streaming binary replication.
+In fact, the server will not even start in this mode if
+max_wal_senders is non-zero.
 Note that changing wal_level to
-minimal makes any base backups taken before
-unavailable for archive recovery and standby server, which may
-lead to data loss.
+minimal makes any base backups taken before this
+unusable for point-in-time recovery and standby servers.


 In logical level, the same information is logged as
-with replica, plus information needed to allow
-extracting logical change sets from the WAL. Using a level of
+with replica, plus information needed to
+extract logical change sets from the WAL. Using a level of
 logical will increase the WAL volume, particularly if many
 tables are configured for REPLICA IDENTITY FULL and
 many UPDATE and DELETE statements are


Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-15 Thread David G. Johnston
On Fri, Jul 15, 2022 at 6:27 AM Japin Li  wrote:

>
> >
> > +servers.  If setting max_wal_senders to
> > +0 consider also reducing the amount of WAL
> produced
> > +by changing wal_level to
> minimal.
> >
> > I don't think this is great advice.  It will encourage people to use
> > wal_level = minimal even if they have other requirements that weigh
> > against it.  If they feel that their system is producing too much
> > WAL, I doubt they'll have a hard time finding the wal_level knob.
> >
>
> Agreed. It isn't good advice.  We can remove the suggestion.
>
>
Yeah, I wrote that thinking that max_wal_senders being set to 0 implied
archive_mode = off, but that isn't the case.

David J.


Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-15 Thread Japin Li


On Fri, 15 Jul 2022 at 08:49, Bruce Momjian  wrote:
> On Tue, Jul  5, 2022 at 08:02:33PM -0400, Tom Lane wrote:
>> "Precondition" is an overly fancy word that makes things less clear
>> not more so.  Does it mean that setting wal_level = minimal will fail
>> if you don't do these other things, or does it just mean that you
>> won't be getting the absolute minimum WAL volume?  If the former,
>> I think it'd be better to say something like "To set wal_level to minimal,
>> you must also set [these variables], which has the effect of disabling
>> both WAL archiving and streaming replication."
>
> I have created the attached patch to try to improve this text.

IMO we can add the following sentence for wal_level description, since
if wal_level = minimal and max_wal_senders > 0, we cannot start the database.

To set wal_level to minimal, you must also set max_wal_senders to 0,
which has the effect of disabling both WAL archiving and streaming
replication.

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.




Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-15 Thread Japin Li


Sorry for the late reply.

On Wed, 06 Jul 2022 at 08:02, Tom Lane  wrote:
> Japin Li  writes:
>> [ v4-wal-level-documentation.patch ]
>
> Hm, I don't care for the wording here:
>
> +A precondition for using minimal WAL is to disable WAL archiving and
> +streaming replication by setting archive_mode to
> +off, and  to
> +0.
>
> "Precondition" is an overly fancy word that makes things less clear
> not more so.  Does it mean that setting wal_level = minimal will fail
> if you don't do these other things, or does it just mean that you
> won't be getting the absolute minimum WAL volume?  If the former,
> I think it'd be better to say something like "To set wal_level to minimal,
> you must also set [these variables], which has the effect of disabling
> both WAL archiving and streaming replication."

Yeah, it's the former case.

>
> +servers.  If setting max_wal_senders to
> +0 consider also reducing the amount of WAL 
> produced
> +by changing wal_level to 
> minimal.
>
> I don't think this is great advice.  It will encourage people to use
> wal_level = minimal even if they have other requirements that weigh
> against it.  If they feel that their system is producing too much
> WAL, I doubt they'll have a hard time finding the wal_level knob.
>

Agreed. It isn't good advice.  We can remove the suggestion.


--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.




Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-14 Thread Bruce Momjian
On Tue, Jul  5, 2022 at 08:02:33PM -0400, Tom Lane wrote:
> "Precondition" is an overly fancy word that makes things less clear
> not more so.  Does it mean that setting wal_level = minimal will fail
> if you don't do these other things, or does it just mean that you
> won't be getting the absolute minimum WAL volume?  If the former,
> I think it'd be better to say something like "To set wal_level to minimal,
> you must also set [these variables], which has the effect of disabling
> both WAL archiving and streaming replication."

I have created the attached patch to try to improve this text.

-- 
  Bruce Momjian  https://momjian.us
  EDB  https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 37fd80388c..964f9fb379 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2764,9 +2764,10 @@ include_dir 'conf.d'
 levels.  This parameter can only be set at server start.


-In minimal level, no information is logged for
-permanent relations for the remainder of a transaction that creates or
-rewrites them.  This can make operations much faster (see
+The minimal level generates the least WAL
+volume.  It logs no row information for permanent relations
+in transactions that create or
+rewrite them.  This can make operations much faster (see
 ).  Operations that initiate this
 optimization include:
 
@@ -2778,19 +2779,18 @@ include_dir 'conf.d'
  REINDEX
  TRUNCATE
 
-But minimal WAL does not contain enough information to reconstruct the
-data from a base backup and the WAL logs, so replica or
-higher must be used to enable WAL archiving
-() and streaming replication.
+However, minimal WAL does not contain sufficient information for
+point-in-time recovery, so replica or
+higher must be used to enable continuous archiving
+() and streaming binary replication.
 Note that changing wal_level to
-minimal makes any base backups taken before
-unavailable for archive recovery and standby server, which may
-lead to data loss.
+minimal makes any base backups taken before this
+unusable for point-in-time recovery and standby servers.


 In logical level, the same information is logged as
-with replica, plus information needed to allow
-extracting logical change sets from the WAL. Using a level of
+with replica, plus information needed to
+extract logical change sets from the WAL. Using a level of
 logical will increase the WAL volume, particularly if many
 tables are configured for REPLICA IDENTITY FULL and
 many UPDATE and DELETE statements are


Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-07-05 Thread Tom Lane
Japin Li  writes:
> [ v4-wal-level-documentation.patch ]

Hm, I don't care for the wording here:

+A precondition for using minimal WAL is to disable WAL archiving and
+streaming replication by setting archive_mode to
+off, and  to
+0.

"Precondition" is an overly fancy word that makes things less clear
not more so.  Does it mean that setting wal_level = minimal will fail
if you don't do these other things, or does it just mean that you
won't be getting the absolute minimum WAL volume?  If the former,
I think it'd be better to say something like "To set wal_level to minimal,
you must also set [these variables], which has the effect of disabling
both WAL archiving and streaming replication."

+servers.  If setting max_wal_senders to
+0 consider also reducing the amount of WAL produced
+by changing wal_level to minimal.

I don't think this is great advice.  It will encourage people to use
wal_level = minimal even if they have other requirements that weigh
against it.  If they feel that their system is producing too much
WAL, I doubt they'll have a hard time finding the wal_level knob.

TBH, I think the real problem with the docs in this area is that
the first para about wal_level is disjointed and unclear; we ought
to nuke and rewrite that.  In particular it fails to provide adequate
context about what "logical decoding" means.  I think possibly what
it needs to say is that replica mode supports *physical* replication
but if you want to use *logical* replication you need logical mode;
if you need neither, and are not doing WAL archiving either, you
can get away with minimal mode.

regards, tom lane




Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-07 Thread David G. Johnston
On Fri, Mar 4, 2022 at 2:49 AM Japin Li  wrote:

> Thanks for your review.  Modified.
>

Works for me.  I have some additional sparks of ideas but nothing that need
hold this up.

David J.


Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-07 Thread David G. Johnston
On Thu, Mar 3, 2022 at 11:05 PM Kyotaro Horiguchi 
wrote:

> But,
> anyway, IMHO, it is mere a performance tips that is not necessarily
> required in this section, or even in this documentaiotn.  Addtion to
> that, if we write this for max_wal_senders, archive_mode will deserve
> the similar tips but I think it is too verbose.  In short, I think I
> would not add that description at all.
>
>
I wrote it as a performance tip but it is documenting that when set to 0 no
features of the server require more information than is captured in the
minimal wal.  That fact seems worthy of noting.  Even at the cost of a bit
of verbosity.  These features interact with each other and that interaction
should be adequately described.  While subjective, this dynamic seems to
warrant inclusion.

David J.


Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-04 Thread Japin Li

On Fri, 04 Mar 2022 at 14:05, Kyotaro Horiguchi  wrote:
> At Fri, 04 Mar 2022 12:18:29 +0800, Japin Li  wrote in 
>> 
>> On Thu, 03 Mar 2022 at 12:10, Japin Li  wrote:
>>
>> Attach v3 patch to fix missing close varname tag.
>
> +A precondition for using minimal WAL is to disable WAL archiving and
> +streaming replication by setting  linkend="guc-max-wal-senders"/>
> +to 0, and archive_mode
> +to off.
>
> It is a bit odd that the features to stop and the corresponding GUCs
> are written irrespectively. It would be better they're in the same
> order.
>

Thanks for your review.  Modified.

> +servers.  If setting max_wal_senders to
> +0 consider also reducing the amount of WAL 
> produced
> +by changing wal_level to 
> minimal.
>
> Those who anively follow this suggestion may bump into failure when
> arhive_mode is on.  Thus archive_mode is also worth referred to.  But,
> anyway, IMHO, it is mere a performance tips that is not necessarily
> required in this section, or even in this documentaiotn.  Addtion to
> that, if we write this for max_wal_senders, archive_mode will deserve
> the similar tips but I think it is too verbose.  In short, I think I
> would not add that description at all.
>

It already has a tip about wal_level for archive_mode [1], IIUC.

archive_mode cannot be enabled when wal_level is set to minimal.


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

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 7ed8c82a9d..a70adb7030 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2775,6 +2775,10 @@ include_dir 'conf.d'
 minimal makes any base backups taken before
 unavailable for archive recovery and standby server, which may
 lead to data loss.
+A precondition for using minimal WAL is to disable WAL archiving and
+streaming replication by setting archive_mode to
+off, and  to
+0.


 In logical level, the same information is logged as
@@ -3535,6 +3539,7 @@ include_dir 'conf.d'
 mode. In always mode, all files restored from the archive
 or streamed with streaming replication will be archived (again). See
  for details.
+The default value is off.


 This parameter can only be set at server start.
@@ -4096,7 +4101,9 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"'  # Windows
 reconnect.  This parameter can only be set at server start.  Also,
 wal_level must be set to
 replica or higher to allow connections from standby
-servers.
+servers.  If setting max_wal_senders to
+0 consider also reducing the amount of WAL produced
+by changing wal_level to minimal.

 



Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-03 Thread Kyotaro Horiguchi
At Fri, 04 Mar 2022 12:18:29 +0800, Japin Li  wrote in 
> 
> On Thu, 03 Mar 2022 at 12:10, Japin Li  wrote:
>
> Attach v3 patch to fix missing close varname tag.

+A precondition for using minimal WAL is to disable WAL archiving and
+streaming replication by setting 
+to 0, and archive_mode
+to off.

It is a bit odd that the features to stop and the corresponding GUCs
are written irrespectively. It would be better they're in the same
order.

+servers.  If setting max_wal_senders to
+0 consider also reducing the amount of WAL produced
+by changing wal_level to minimal.

Those who anively follow this suggestion may bump into failure when
arhive_mode is on.  Thus archive_mode is also worth referred to.  But,
anyway, IMHO, it is mere a performance tips that is not necessarily
required in this section, or even in this documentaiotn.  Addtion to
that, if we write this for max_wal_senders, archive_mode will deserve
the similar tips but I think it is too verbose.  In short, I think I
would not add that description at all.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center




Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-03 Thread Japin Li

On Thu, 03 Mar 2022 at 12:10, Japin Li  wrote:
> On Thu, 03 Mar 2022 at 11:25, David G. Johnston  
> wrote:
>> I would suggest a wording more like:
>>
>> "A precondition for using minimal WAL is to disable WAL archiving and
>> streaming replication by setting max_wal_senders to 0, and archive_mode to
>> off."
>>
>> While accurate, the phrase "you must set" just doesn't feel right to me.  I
>> also don't like how the proposed sentence (either one) is added separately
>> as opposed to being included in the immediately preceding paragraph.  While
>> this limited patch is probably sufficient I would suggest trying to work
>> out a slightly larger patch the improves the wording on the entire existing
>> paragraph while incorporating the reference to max_wal_senders.
>>
>
> Thanks for your review.  Modified as your suggestion.
>
>> Note, we seem to be missing the documentation of the default setting for
>> archive_mode.
>>
>
> Add the default value for archive_mode.
>
>> In addition, max_wal_senders could also be changed, adding a sentence like:
>>
>> "If setting max_wal_senders to 0 consider also reducing the amount of WAL
>> produced by changing wal_level to minimal."
>>
>
> Modified.

Attach v3 patch to fix missing close varname tag.

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 7ed8c82a9d..bc7ba1e120 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2775,6 +2775,10 @@ include_dir 'conf.d'
 minimal makes any base backups taken before
 unavailable for archive recovery and standby server, which may
 lead to data loss.
+A precondition for using minimal WAL is to disable WAL archiving and
+streaming replication by setting 
+to 0, and archive_mode
+to off.


 In logical level, the same information is logged as
@@ -3535,6 +3539,7 @@ include_dir 'conf.d'
 mode. In always mode, all files restored from the archive
 or streamed with streaming replication will be archived (again). See
  for details.
+The default value is off.


 This parameter can only be set at server start.
@@ -4096,7 +4101,9 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"'  # Windows
 reconnect.  This parameter can only be set at server start.  Also,
 wal_level must be set to
 replica or higher to allow connections from standby
-servers.
+servers.  If setting max_wal_senders to
+0 consider also reducing the amount of WAL produced
+by changing wal_level to minimal.

 



Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-02 Thread Japin Li

On Thu, 03 Mar 2022 at 11:25, David G. Johnston  
wrote:
> I would suggest a wording more like:
>
> "A precondition for using minimal WAL is to disable WAL archiving and
> streaming replication by setting max_wal_senders to 0, and archive_mode to
> off."
>
> While accurate, the phrase "you must set" just doesn't feel right to me.  I
> also don't like how the proposed sentence (either one) is added separately
> as opposed to being included in the immediately preceding paragraph.  While
> this limited patch is probably sufficient I would suggest trying to work
> out a slightly larger patch the improves the wording on the entire existing
> paragraph while incorporating the reference to max_wal_senders.
>

Thanks for your review.  Modified as your suggestion.

> Note, we seem to be missing the documentation of the default setting for
> archive_mode.
>

Add the default value for archive_mode.

> In addition, max_wal_senders could also be changed, adding a sentence like:
>
> "If setting max_wal_senders to 0 consider also reducing the amount of WAL
> produced by changing wal_level to minimal."
>

Modified.

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 7ed8c82a9d..4fd36fa53a 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2775,6 +2775,10 @@ include_dir 'conf.d'
 minimal makes any base backups taken before
 unavailable for archive recovery and standby server, which may
 lead to data loss.
+A precondition for using minimal WAL is to disable WAL archiving and
+streaming replication by setting 
+to 0, and archive_mode
+to off.


 In logical level, the same information is logged as
@@ -3535,6 +3539,7 @@ include_dir 'conf.d'
 mode. In always mode, all files restored from the archive
 or streamed with streaming replication will be archived (again). See
  for details.
+The default value is off.


 This parameter can only be set at server start.
@@ -4096,7 +4101,9 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"'  # Windows
 reconnect.  This parameter can only be set at server start.  Also,
 wal_level must be set to
 replica or higher to allow connections from standby
-servers.
+servers.  If setting max_wal_senders to
+0 consider also reducing the amount of WAL produced
+by changing wal_level to minimal.

 



Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-02 Thread David G. Johnston
On Wed, Mar 2, 2022 at 7:44 PM Japin Li  wrote:

>
> Hi, hackers
>
> When I try to change wal_level to minimal and restart the database, it
> complains
> max_wal_senders > 0.
>
> 2022-03-03 10:10:16.938 CST [6389] FATAL:  WAL streaming (max_wal_senders
> > 0) requires wal_level "replica" or "logical"
>
> However, the documentation about wal_level [1] doesn't mentation this.
> How about adding a sentence to describe how to set max_wal_senders when
> setting wal_level to minimal?
>
> [1] https://www.postgresql.org/docs/devel/runtime-config-wal.html
>
>
I would suggest a wording more like:

"A precondition for using minimal WAL is to disable WAL archiving and
streaming replication by setting max_wal_senders to 0, and archive_mode to
off."

While accurate, the phrase "you must set" just doesn't feel right to me.  I
also don't like how the proposed sentence (either one) is added separately
as opposed to being included in the immediately preceding paragraph.  While
this limited patch is probably sufficient I would suggest trying to work
out a slightly larger patch the improves the wording on the entire existing
paragraph while incorporating the reference to max_wal_senders.

Note, we seem to be missing the documentation of the default setting for
archive_mode.

In addition, max_wal_senders could also be changed, adding a sentence like:

"If setting max_wal_senders to 0 consider also reducing the amount of WAL
produced by changing wal_level to minimal."

At least insofar as core is concerned without a wal sender the additional
wal of replica is not actually able to be leveraged as pg_basebackup will
not work (at noted in its own description).

David J.


Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-02 Thread Japin Li

Hi, hackers

When I try to change wal_level to minimal and restart the database, it complains
max_wal_senders > 0.

2022-03-03 10:10:16.938 CST [6389] FATAL:  WAL streaming (max_wal_senders > 0) 
requires wal_level "replica" or "logical"

However, the documentation about wal_level [1] doesn't mentation this.
How about adding a sentence to describe how to set max_wal_senders when
setting wal_level to minimal?

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

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 7ed8c82a9d..3f5ecc4a04 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2776,6 +2776,10 @@ include_dir 'conf.d'
 unavailable for archive recovery and standby server, which may
 lead to data loss.

+   
+When changing wal_level to minimal,
+you must set the  parameter to 0.
+   

 In logical level, the same information is logged as
 with replica, plus information needed to allow