Re: [HACKERS] Restricting maximum keep segments by repslots

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: alvherre(at)2ndquadrant(dot)com
Cc: jgdr(at)dalibo(dot)com, andres(at)anarazel(dot)de, michael(at)paquier(dot)xyz, sawada(dot)mshk(at)gmail(dot)com, peter(dot)eisentraut(at)2ndquadrant(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
Subject: Re: [HACKERS] Restricting maximum keep segments by repslots
Date: 2020-04-01 01:25:43
Message-ID: 20200401.102543.257983075916136729.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Tue, 31 Mar 2020 16:59:05 -0300, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote in
> On 2020-Mar-31, Alvaro Herrera wrote:
>
> > On 2020-Mar-31, Alvaro Herrera wrote:
> >
> > > I'm not sure if I explained my proposal clearly. What if
> > > XLogGetLastRemovedSegno returning zero means that every segment is
> > > valid? We don't need to scan pg_xlog at all.
> >
> > I mean this:
>
> [v21 does it that way. Your typo fixes are included, but not the
> LastRemoved stuff being discussed here. I also edited the shortdesc in
> guc.c to better match {min,max}_wal_size.]
>
> Hmm ... but if the user runs pg_resetwal to remove WAL segments, then
> this will work badly for a time (until a segment is removed next). I'm
> not very worried for that scenario, since surely the user will have to
> reclone any standbys anyway. I think your v20 behaves better in that
> case. But I'm not sure we should have that code to cater only to that
> case ... seems to me that it will go untested 99.999% of the time.

I feel the same. If we allow bogus status or "unkown" status before
the first checkpoint, we don't need to scan the directory.

> Maybe you're aware of some other cases where lastRemovedSegNo is not
> correct for the purposes of this feature?

The cases of archive-failure (false "removed") and change of
max_slot_wal_keep_size(false "normal/kept") mentioned in another mail.

> I pushed the silly test_decoding test adjustment to get it out of the
> way.
>
> /me tries to figure out KeepLogSeg next

Thanks.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2020-04-01 01:55:48 Re: backend type in log_line_prefix?
Previous Message Kyotaro Horiguchi 2020-04-01 01:18:04 Re: [HACKERS] Restricting maximum keep segments by repslots