pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: p.luzanov@postgrespro.ru
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pluzanov@postgrespro.ru
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: max_wal_size
Date: Thu, 28 May 2020 12:21:14 +0300
Message-ID: <b8e12875ebec9e6d3107df5fa1129e1e@postgrespro.ru> (raw)
In-Reply-To: <CAKFQuwY=eGGGe7E9xHkdR+8YnKXeA8xp-qfRMGFJrs-Hsb_D5Q@mail.gmail.com>
References: <159057129673.7025.17016799863173731176@wrigleys.postgresql.org>
	<CAKFQuwZOwfUwOxNh5KjUjCSFaecUWxtHEbPHEK8CJF1+zn9Bjg@mail.gmail.com>
	<92491c6d07a3216ef2caee8ef55c02b5@postgrespro.ru>
	<CAKFQuwYOGSRbcWnSEo7vp7JJktdH9rKJM0T8Q3B6J0QJcq==hA@mail.gmail.com>
	<8aac88e2a22cd84e50ee1a2bcf3da9b7@postgrespro.ru>
	<CAKFQuwY=eGGGe7E9xHkdR+8YnKXeA8xp-qfRMGFJrs-Hsb_D5Q@mail.gmail.com>

David,

> I think part of the issue is your operating with a mental model of
> this contrary to the one the documentation was written for.

I made this assumption(checkpoints triggered by size,
checkpoint_completion_target=1) only for simplifying example.
(Although there is a practical task: calculate the possible approximate
size of all WAL files. This is especially important for versions prior
to 11, where WAL files were stored for the previous checkpoint.)

> In any case "grow to" means that it doesn't matter whether at the end
> of the previous checkpoint 1gb or 9gb were in use - once the usage
> goes "up to" 10gp the automatic checkpoint will trigger.  If the word
> "to" wasn't there your interpretation would be correct.  Its a fair
> argument to say such an important distinction shouldn't be placed on
> the word "to" but it isn't wrong.

Thank you for an explanation. But give me another chance to explain.

Now we have the glossary. According to the glossary, a checkpoint has
two meanings.

The first meaning is that this is a point:
"A point in the WAL sequence at which it is guaranteed that the heap and
index data files have been updated with all information from shared
memory modified before that checkpoint; a checkpoint record is written
and flushed to WAL to mark that point."

Simple illustration:
                A           B           C
WAL |-----------|-----------|-----------|----------->

Points A,B,C are records in the WAL.

The second meaning is that this is an action (performed by checkpointer
process or CP):
"A checkpoint is also the act of carrying out all the actions that are
necessary to reach a checkpoint as defined above."

Add a process to the illustration. Checkpoint_completion_target here is
the default value of 0.5:

                A           B           C
WAL |-----------|-----+-----|-----+-----|-----+----->

                   a           b           c  
CP              +-----+     +-----+     +-----+
                b     e     b     e     b     e

Checkpointer process for point A starts at a(b) and ends at a(e).
At the end of the work, CP makes a WAL record(plus symbol on WAL line).

Back to the max_wal_size description:
"Maximum size to let the WAL grow to between automatic WAL checkpoints."

As I understand now, this is true when we talk about the checkpoint as a
process.
"Maximum size to let the WAL grow to between a(b) and b(e), between b(b)
and c(e), etc".

But this not true when we talk about the checkpoint as a point.
"Maximum size to let the WAL grow to between A and B".

My concerns that someone reading the description of the parameter may
confuse the two meanings of checkpoint: as a point and as a process.
After all, this happened to me.

-----
Pavel Luzanov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

view thread (16+ messages)  latest in thread

Message-ID: <b8e12875ebec9e6d3107df5fa1129e1e@postgrespro.ru>
Permalink:  ../b8e12875ebec9e6d3107df5fa1129e1e@postgrespro.ru/
Also on:    postgresql.org/message-id/b8e12875ebec9e6d3107df5fa1129e1e@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: p.luzanov@postgrespro.ru, david.g.johnston@gmail.com, pluzanov@postgrespro.ru, pgsql-docs@lists.postgresql.org
  Subject: Re: max_wal_size
  In-Reply-To: <b8e12875ebec9e6d3107df5fa1129e1e@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox