pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Harden nbtree deduplication posting split code.
Date: Fri, 14 May 2021 22:08:55 +0000
Message-ID: <E1lhfzL-0001cu-47@gemulon.postgresql.org> (raw)

Harden nbtree deduplication posting split code.

Add a defensive "can't happen" error to code that handles nbtree posting
list splits (promote an existing assertion).  This avoids a segfault in
the event of an insertion of a newitem that is somehow identical to an
existing non-pivot tuple in the index.  An nbtree index should never
have two index tuples with identical TIDs.

This scenario is not particular unlikely in the event of any kind of
corruption that leaves the index in an inconsistent state relative to
the heap relation that is indexed.  There are two known reports of
preventable hard crashes.  Doing nothing seems unacceptable given the
general expectation that nbtree will cope reasonably well with corrupt
data.

Discussion: https://postgr.es/m/CAH2-Wz=Jr_d-dOYEEmwz0-ifojVNWho01eAqewfQXgKfoe114w@mail.gmail.com
Backpatch: 13-, where nbtree deduplication was introduced.

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fa675af59fc828d0b71bd9139042d71456640a28

Modified Files
--------------
src/backend/access/nbtree/nbtdedup.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)



view thread (2+ messages)

Message-ID: <E1lhfzL-0001cu-47@gemulon.postgresql.org>
Permalink:  ../E1lhfzL-0001cu-47@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lhfzL-0001cu-47@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: pg@bowt.ie
  Subject: Re: pgsql: Harden nbtree deduplication posting split code.
  In-Reply-To: <E1lhfzL-0001cu-47@gemulon.postgresql.org>
  References: <E1lhfzL-0001cu-47@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