Re: [HACKERS] Restricting maximum keep segments by repslots

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-13 09:29:31
Message-ID: 20180913.182931.87638304.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

Thank you for the comments, Sawada-san, Peter.

At Mon, 10 Sep 2018 19:52:24 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote in <20180910(dot)195224(dot)22629595(dot)horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
> 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>
> 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.
...
> > 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.

I did the following thinkgs in the new version.

- Changed the disable (or infinite) and default value of
max_slot_wal_keep_size to -1 from 0.
(patch 1, 2. guc.c, xlog.c: GetOldestKeepSegment())

- Fixed documentation for max_slot_wal_keep_size tomention what
happnes when WAL exceeds the size, and additional rewrites.
(patch 4, catalogs.sgml, config.sgml)

- Folded parameter list of GetOldestKeepSegment().
(patch 1, 2. xlog.c)

- Provided the plural form of errdetail of checkpoint-time
warning. (patch 1, xlog.c: KeepLogSeg())

- Some cosmetic change and small refactor.
(patch 1, 2, 3)

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
v9-0001-Add-WAL-relief-vent-for-replication-slots.patch text/x-patch 6.8 KB
v9-0002-Add-monitoring-aid-for-max_slot_wal_keep_size.patch text/x-patch 12.0 KB
v9-0003-TAP-test-for-the-slot-limit-feature.patch text/x-patch 6.2 KB
v9-0004-Documentation-for-slot-limit-feature.patch text/x-patch 4.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message PG Bug reporting form 2018-09-13 10:45:21 BUG #15383: Join Filter cost estimation problem in 10.5
Previous Message Arthur Zakirov 2018-09-13 09:02:22 Re: PATCH: Update snowball stemmers