pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: amcheck: Fix posting tree checks in gin_index_check()
Date: Tue, 17 Jun 2025 14:52:24 +0000
Message-ID: <E1uRXfk-0025Y5-0G@gemulon.postgresql.org> (raw)

amcheck: Fix posting tree checks in gin_index_check()

Fix two issues in parent_key validation in posting trees:

* It's not enough to check stack->parentblk is valid to determine if the
  parentkey is valid. It's possible parentblk is set to a valid block
  number, but parentkey is invalid. So check parentkey directly.

* We don't need to invalidate parentkey for all child pages of the
  rightmost page. It's enough to invalidate it for the rightmost child
  only, which means we can check more cases (less false negatives).

Issues reported by Arseniy Mukhin, along with a proposed patch. Review
by Andrey M. Borodin, cleanup and improvements by me.

Author: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Reviewed-by: Andrey M. Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAE7r3MJ611B9TE=YqBBncewp7-k64VWs+sjk7XF6fJUX77uFBA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0cf205e122ae0fe9333ccf843c2269f13ddc32fc

Modified Files
--------------
contrib/amcheck/t/006_verify_gin.pl | 39 +++++++++++++++++++++++++++++++++++++
contrib/amcheck/verify_gin.c        | 12 ++++--------
2 files changed, 43 insertions(+), 8 deletions(-)



Message-ID: <E1uRXfk-0025Y5-0G@gemulon.postgresql.org>
Permalink:  ../E1uRXfk-0025Y5-0G@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uRXfk-0025Y5-0G@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: tomas.vondra@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: amcheck: Fix posting tree checks in gin_index_check()
  In-Reply-To: <E1uRXfk-0025Y5-0G@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