Re: GIN pageinspect support for entry tree and posting tree

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Roman Khapov <rkhapov(at)yandex-team(dot)ru>
Subject: Re: GIN pageinspect support for entry tree and posting tree
Date: 2026-01-10 07:41:26
Message-ID: CALdSSPjNL8ga9e1oFCwV5=MpoOiz0jWm0rXdJH+Wb60EwAOaMg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 10 Jan 2026 at 07:20, Japin Li <japinli(at)hotmail(dot)com> wrote:
> >
> > PFA v12.
> >
>
> Just a few small nitpicks on v12:

Hi!
Thank you for your review.

> 1.
> + /* Open the relation */
> + indexRel = index_open(indexRelid, AccessShareLock);
>
> "relation" is technically correct, but "index" feels more precise here.

I have updated this comment, thanks

> 2.
> + if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
> + ereport(ERROR,
> + errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> + errmsg("input page is not a valid GIN entry tree page"),
> + errdetail("Expected special size %d, got %d.",
> + (int) MAXALIGN(sizeof(GinPageOpaqueData)),
> + PageGetSpecialSize(page)));
>
> Cast the second PageGetSpecialSize(page) to int as well, for consistency.

Fixed.

> 3.
> + /* orig tuple reuse is safe */
> +
> + res = index_getattr(idxtuple, FirstOffsetNumber, tupdesc, &isnull);
>
> Does "orig tuple" refer to `idxtuple` here? If so, maybe the comment could be
> slightly clearer, e.g.:
>
> /* Safe to reuse the original index tuple */

I have rephrased this comment.

> 4.
> +
> + return (Datum) 0;
>
> Since this appears to be a void-returning function, consider using_RETURN_VOID()
> instead — it's the conventional way and slightly more self-documenting.
>

No, this function returns SET OF RECORD. So, `return (Datum) 0;` is
not exactly VOID or NULL, it is rather the end of the output marker.
You can also see `
gist_page_items`

Your comments refer to v12-0002. For the record, did you review 0001,
if yes, do you think it is good? I have included you as a reviewer to
v12-0002 commit message.

--
Best regards,
Kirill Reshke

Attachment Content-Type Size
v13-0001-Modernize-coding-in-GIN-pageinspect-functions.patch application/octet-stream 5.3 KB
v13-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch application/octet-stream 30.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2026-01-10 07:53:52 Re: [PATCH] Fix minor issues in astreamer_zstd.c
Previous Message Japin Li 2026-01-10 07:03:10 Re: [PATCH] Fix minor issues in astreamer_zstd.c