From: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | peter(dot)eisentraut(at)2ndquadrant(dot)com |
Cc: | sawada(dot)mshk(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, thomas(dot)munro(at)enterprisedb(dot)com, sk(at)zsrv(dot)org, michael(dot)paquier(at)gmail(dot)com, andres(at)anarazel(dot)de |
Subject: | Re: [HACKERS] Restricting maximum keep segments by repslots |
Date: | 2018-09-10 10:52:24 |
Message-ID: | 20180910.195224.22629595.horiguchi.kyotaro@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello.
At Thu, 6 Sep 2018 22:32:21 +0200, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote in <29bbd79d-696b-509e-578a-0fc38a3b9405(at)2ndquadrant(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Aleksandr Parfenov | 2018-09-10 11:02:10 | Re: [PATCH][PROPOSAL] Add enum releation option type |
Previous Message | Rafia Sabih | 2018-09-10 10:50:34 | Re: Latest HEAD fails to build |