pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum
Date: Wed, 10 Nov 2021 18:20:05 -0800
Message-ID: <20211111022005.eodwq7o44p3dm3gz@alap3.anarazel.de> (raw)
In-Reply-To: <20211111021618.n5ebam6f6licj746@alap3.anarazel.de>
References: <20211108172852.pvsarxoxi54uatch@localhost>
	<CAH2-Wzka8u1Y+GNP41TQiHjLMP7mYG9h3i+5jq-FzSKgWXBk+Q@mail.gmail.com>
	<20211109150216.fgfybn35mwnkeef3@localhost>
	<CAH2-Wzma=Y3O+LRx2Wj_HwGbbbeNwr6FoJzXni8hxOMw55pcZg@mail.gmail.com>
	<CAH2-WznNKY6ydUczuTXutVmb_dj3MnAcoaVYc8xyignWfNQ=FQ@mail.gmail.com>
	<20211110192010.ckvfzz352hsba5xf@alap3.anarazel.de>
	<CAH2-WzmqBtFwdmBW=AG8ZZW_uF5a4entmv4QmqhsXOT-Fj4L-g@mail.gmail.com>
	<20211111004727.imn7xrimdiyo7vfv@alap3.anarazel.de>
	<CAH2-Wz=QrJsLN3UhQ2KOXsdubhqfuNUQiJDjESubscPdaDT5eg@mail.gmail.com>
	<20211111021618.n5ebam6f6licj746@alap3.anarazel.de>

Hi,

On 2021-11-10 18:16:18 -0800, Andres Freund wrote:
> On 2021-11-10 17:37:38 -0800, Peter Geoghegan wrote:
> > You might also move the call to GlobalVisTestFor() out of
> > lazy_scan_heap(), so that it gets called right after
> > vacuum_set_xid_limits(). That would make the new explanation easier to
> > follow, since you are after all explaining the relationship between
> > OldestXmin (or the vacuum_set_xid_limits() call itself) and vistest
> > (or the GlobalVisTestFor() call itself).
> > 
> > Why do they have to be called in that order? Or do they? I noticed
> > that "make check-world" won't break if you switch the order.
> 
> We need pruning to be at least as aggressive as relfrozenxid. If we did it the
> other way round, we couldn't guarantee that.

There's a relevant comment above ComputeXidHorizons():

 * Note: the approximate horizons (see definition of GlobalVisState) are
 * updated by the computations done here. That's currently required for
 * correctness and a small optimization. Without doing so it's possible that
 * heap vacuum's call to heap_page_prune() uses a more conservative horizon
 * than later when deciding which tuples can be removed - which the code
 * doesn't expect (breaking HOT).

Greetings,

Andres Freund





view thread (90+ messages)  latest in thread

Message-ID: <20211111022005.eodwq7o44p3dm3gz@alap3.anarazel.de>
Permalink:  ../20211111022005.eodwq7o44p3dm3gz@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20211111022005.eodwq7o44p3dm3gz@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, pg@bowt.ie, 9erthalion6@gmail.com, exclusion@gmail.com, boekewurm+postgres@gmail.com
  Subject: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum
  In-Reply-To: <20211111022005.eodwq7o44p3dm3gz@alap3.anarazel.de>
  References: <20211108172852.pvsarxoxi54uatch@localhost> <CAH2-Wzka8u1Y+GNP41TQiHjLMP7mYG9h3i+5jq-FzSKgWXBk+Q@mail.gmail.com> <20211109150216.fgfybn35mwnkeef3@localhost> <CAH2-Wzma=Y3O+LRx2Wj_HwGbbbeNwr6FoJzXni8hxOMw55pcZg@mail.gmail.com> <CAH2-WznNKY6ydUczuTXutVmb_dj3MnAcoaVYc8xyignWfNQ=FQ@mail.gmail.com> <20211110192010.ckvfzz352hsba5xf@alap3.anarazel.de> <CAH2-WzmqBtFwdmBW=AG8ZZW_uF5a4entmv4QmqhsXOT-Fj4L-g@mail.gmail.com> <20211111004727.imn7xrimdiyo7vfv@alap3.anarazel.de> <CAH2-Wz=QrJsLN3UhQ2KOXsdubhqfuNUQiJDjESubscPdaDT5eg@mail.gmail.com> <20211111021618.n5ebam6f6licj746@alap3.anarazel.de> <20211111022005.eodwq7o44p3dm3gz@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox