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: Fix GIN posting tree page deletion with incomplete splits.
Date: Sat, 22 Aug 2026 18:50:54 +0000
Message-ID: <E1wxqnt-00000001gDp-0aWw@gemulon.postgresql.org> (raw)

Fix GIN posting tree page deletion with incomplete splits.

GIN posting tree page deletion failed to consider whether the target
page's left sibling page, or the deletion target itself, was marked as
incompletely split.  Page deletion finds the target page's left sibling
by walking the parent's downlinks, but an incompletely split page's new
right half is part of the sibling chain despite having no downlink.
Deletion could therefore overwrite the rightlink of the wrong page,
disconnecting the split's still-live right half from the sibling chain.
Scans would then silently miss tuples from that page.

To fix, teach the relevant page deletion path to avoid deleting a
posting tree page whose left sibling is marked incompletely split (and
to avoid doing so when the target page itself is so marked).  This is
essentially the same approach used by nbtree page deletion.

Claude Code found this problem.  The committed test case is a simplified
version of the one that it wrote to demonstrate this bug.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAH2-Wz=sKJcn+OtfVN9rdg+Ps9e4cuQWNP-9t12UE2d8nEG90Q@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4dd227f51d461b6cbbcdc7d5805ec6ef4023a715

Modified Files
--------------
src/backend/access/gin/ginvacuum.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1wxqnt-00000001gDp-0aWw@gemulon.postgresql.org>
Permalink:  ../E1wxqnt-00000001gDp-0aWw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wxqnt-00000001gDp-0aWw@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: pg@bowt.ie, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix GIN posting tree page deletion with incomplete splits.
  In-Reply-To: <E1wxqnt-00000001gDp-0aWw@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