pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix wrong data table horizon computation during backend startup.
Date: Thu, 29 Oct 2020 04:54:23 +0000
Message-ID: <E1kXzx9-0006ie-RW@gemulon.postgresql.org> (raw)

Fix wrong data table horizon computation during backend startup.

When ComputeXidHorizons() was called before MyDatabaseOid is set,
e.g. because a dead row in a shared relation is encountered during
InitPostgres(), the horizon for normal tables was computed too
aggressively, ignoring all backends connected to a database.

During subsequent pruning in a data table the too aggressive horizon
could end up still being used, possibly leading to still needed tuples
being removed. Not good.

This is a bug in dc7420c2c92, which the test added in 94bc27b5768 made
visible, if run with force_parallel_mode set to regress. In that case
the bug is reliably triggered, because "pruning_query" is run in a
parallel worker and the start of that parallel worker is likely to
encounter a dead row in pg_database.

The fix is trivial: Compute a more pessimistic data table horizon if
MyDatabaseId is not yet known.

Author: Andres Freund
Discussion: https://postgr.es/m/20201029040030.p4osrmaywhqaesd4@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1c7675a7a4265064a2c8e1ed02b2c042c2521664

Modified Files
--------------
src/backend/storage/ipc/procarray.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)



Message-ID: <E1kXzx9-0006ie-RW@gemulon.postgresql.org>
Permalink:  ../E1kXzx9-0006ie-RW@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kXzx9-0006ie-RW@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: Fix wrong data table horizon computation during backend startup.
  In-Reply-To: <E1kXzx9-0006ie-RW@gemulon.postgresql.org>
  References: <E1kXzx9-0006ie-RW@gemulon.postgresql.org>

* 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