Hello.

At Thu, 6 Sep 2018 22:32:21 +0200, Peter Eisentraut 
<peter.eisentr...@2ndquadrant.com> wrote in 
<29bbd79d-696b-509e-578a-0fc38a3b9...@2ndquadrant.com>
> This documentation
> 
> +       <para>
> +        Specify the maximum size of WAL files
> +        that <link linkend="streaming-replication-slots">replication
> +        slots</link> are allowed to retain in the
> <filename>pg_wal</filename>
> +        directory at checkpoint time.
> +        If <varname>max_slot_wal_keep_size</varname> is zero (the default),
> +        replication slots retain unlimited size of WAL files.
> +       </para>
> 
> doesn't say anything about what happens when the limit is exceeded.
> Does the system halt until the WAL is fetched from the slots?  Do the
> slots get invalidated?

Thanks for pointing that. That's a major cause of confusion. Does
the following make sense?

> Specify the maximum size of WAL files that <link
> linkend="streaming-replication-slots">replication slots</link>
> are allowed to retain in the <filename>pg_wal</filename>
> directory at checkpoint time.  If
> <varname>max_slot_wal_keep_size</varname> is zero (the
> default), replication slots retain unlimited size of WAL files.
+ If restart_lsn of a replication slot gets behind more than that
+ bytes from the current LSN, the standby using the slot may not
+ be able to reconnect due to removal of required WAL records.

And the following sentense is wrong now. I'll remove it in the
coming version 9.

> <para>
>  This parameter is used being rounded down to the multiples of WAL file
>  size.
> </para>


> Also, I don't think 0 is a good value for the default behavior.  0 would
> mean that a slot is not allowed to retain any more WAL than already
> exists anyway.  Maybe we don't want to support that directly, but it's a
> valid configuration.  So maybe use -1 for infinity.

In realtion to the reply just sent to Sawada-san, remain of a
slot can be at most 16MB in the 0 case with the default segment
size. So you're right in this sense. Will fix in the coming
version. Thanks.

=# show max_slot_wal_keep_size;
 max_slot_wal_keep_size 
------------------------
 0
(1 row)
=# select pg_current_wal_lsn(), restart_lsn, remain, pg_size_pretty(remain) as 
remain from pg_replication_slots ;
 pg_current_wal_lsn | restart_lsn |  remain  | remain 
--------------------+-------------+----------+--------
 0/4000000          | 0/4000000   | 16777216 | 16 MB
(1 row)
....
=# select pg_current_wal_lsn(), restart_lsn, remain, pg_size_pretty(remain) as 
remain from pg_replication_slots ;
 pg_current_wal_lsn | restart_lsn | remain | remain 
--------------------+-------------+--------+--------
 0/4FF46D8          | 0/4FF46D8   |  47400 | 46 kB
(1 row)

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center


Reply via email to