Re: xid wraparound danger due to INDEX_CLEANUP false

From: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: xid wraparound danger due to INDEX_CLEANUP false
Date: 2020-05-06 09:27:53
Message-ID: CA+fd4k5FCeDa6w_wiT-E-N-y8jmTqxJ5o9QzxSNeo-CXk0jXfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 6 May 2020 at 07:17, Masahiko Sawada
<masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:
>
> On Wed, 6 May 2020 at 07:14, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> >
> > On Tue, May 5, 2020 at 2:52 PM Masahiko Sawada
> > <masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:
> > > So IIUC the problem is that since we skip both,
> > > oldst_btpo_xact could be seen as a "future" xid during vacuum. Which
> > > will be a cause of that vacuum misses pages which can actually be
> > > recycled.
> >
> > This is also my understanding of the problem.
> >
> > > I think we can fix this issue by calling vacuumcleanup callback when
> > > an anti-wraparound vacuum even if INDEX_CLEANUP is false. That way we can
> > > let index AM make decisions whether doing cleanup index at least once
> > > until XID wraparound, same as before.
> >
> > +1
> >
> > Can you work on a patch?
>
> Yes, I'll submit a bug fix patch.
>

I've attached the patch fixes this issue.

With this patch, we don't skip only index cleanup phase when
performing an aggressive vacuum. The reason why I don't skip only
index cleanup phase is that index vacuum phase can be called multiple
times, which takes a very long time. Since the purpose of this index
cleanup is to process recyclable pages it's enough to do only index
cleanup phase. However it also means we do index cleanup even when
table might have garbage whereas we used to call index cleanup only
when there is no garbage on a table. As far as I can think it's no
problem but perhaps needs more research.

Regards,

--
Masahiko Sawada http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
fix_index_cleanup.patch application/octet-stream 4.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-05-06 11:05:46 Re: Optimization for hot standby XLOG_STANDBY_LOCK redo
Previous Message Alexander Korotkov 2020-05-06 08:14:49 Re: Own index methods