Re: Amcheck verification of GiST and GIN

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, Andrey Borodin <amborodin86(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, Jose Arthur Benetasso Villanova <jose(dot)arthur(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(at)vondra(dot)me>
Subject: Re: Amcheck verification of GiST and GIN
Date: 2024-12-02 07:57:42
Message-ID: CALdSSPh_Yq+eTjHJg50+yq03-bG-S-r+frVTWcYA+FM6DY=bcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 29 Nov 2024 at 22:24, Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
ic(buffer);
> - maxoff = PageGetMaxOffsetNumber(page);
> + maxoff = GinPageGetOpaque(page)->maxoff;

This change was not correct at all.
PFA v32.

Little sketch of what's changed:
1) More debug1-debug3 output added.
2) Assertion failure under debug3 (pointed by Tomas Vonda) resolved
again. The fix is not to call ItemPointerGetOffsetNumber on rightmost
tuple, because,
ItemPointerGetOffsetNumber expects a valid pointer and rightmost tuple
pointer is (0, 0)
3) pgindent run

only 0004 was changed since v31. To clarify, gin_index_check still
does not work under some conditions. So, works on some types of
indexes and does not on others.
I think the issue is around the full entry page.

Repro:
```
db1=# create table ttt(t text);
CREATE TABLE
db1=# create index on ttt using gin(t gin_trgm_ops);
CREATE INDEX
db1=# insert into ttt select md5(random()::text) from generate_series(1,50000);
INSERT 0 50000
db1=# set client_min_messages to debug5;
DEBUG: CommitTransaction(1) name: unnamed; blockState: STARTED;
state: INPROGRESS, xid/subid/cid: 0/1/0
SET
db1=# select gin_index_check('ttt_t_idx');
DEBUG: StartTransaction(1) name: unnamed; blockState: DEFAULT; state:
INPROGRESS, xid/subid/cid: 0/1/0
DEBUG: processing entry tree page at blk 1, maxoff: 2
DEBUG: processing entry tree page at blk 941, maxoff: 229
ERROR: index "ttt_t_idx" has wrong tuple order on entry tree page,
block 941, offset 229
db1=#
```
I have only observed failures on the last tuple of the entry page. All
other known issues that were on v31 are now fixed (I hope).

--
Best regards,
Kirill Reshke

Attachment Content-Type Size
v32-0005-Add-GiST-support-to-pg_amcheck.patch application/octet-stream 35.6 KB
v32-0002-Refactor-amcheck-internals-to-isolate-common-loc.patch application/octet-stream 21.4 KB
v32-0001-A-tiny-nitpicky-tweak-to-beautify-the-Amcheck-in.patch application/octet-stream 948 bytes
v32-0004-Add-gin_index_check-to-verify-GIN-index.patch application/octet-stream 33.2 KB
v32-0003-Add-gist_index_check-function-to-verify-GiST-ind.patch application/octet-stream 34.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-12-02 08:00:49 Re: UUID v7
Previous Message Tom Lane 2024-12-02 07:52:50 Re: More CppAsString2() in psql's describe.c