Re: GIN tries to form a tuple with a partial compressedList during insertion

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Arseniy Mukhin <arseniy(dot)mukhin(dot)dev(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: GIN tries to form a tuple with a partial compressedList during insertion
Date: 2025-09-25 22:20:59
Message-ID: CAD21AoCigf-S=NeqscAvqq+5Jnqh2KkVeARPZgPf7dGQ=uJLww@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 2, 2025 at 12:41 PM Arseniy Mukhin
<arseniy(dot)mukhin(dot)dev(at)gmail(dot)com> wrote:
>
> Hi!
>
> Here is a new version. I added a commit message. I will add it to PG19-2.

Thank you for the patch.

I think the proposed change is reasonable; if we fail to compress all
ItemPointers, it doesn't make sense to try to form a tuple from it.

Here are some review comments:

---
- compressedList = ginCompressPostingList(newItems, newNPosting,
GinMaxItemSize,
-
NULL);
+ compressedList = ginCompressPostingList(newItems, newNPosting,
GinMaxItemSize - GinGetPostingOffset(old),
+
&nwritten);

Why does it need to subtract GinGetPostingOffset(old) from the maxsize?

---
pfree(newItems);
- if (compressedList)
+ if (nwritten == newNPosting)
{
res = GinFormTuple(ginstate, attnum, key, category,
(char *) compressedList,

SizeOfGinPostingList(compressedList),
newNPosting,
false);
- pfree(compressedList);
}
+ pfree(compressedList);

I think it would be cleaner if we move 'pfree(newItems)' to before
'pfree(compressedList)'.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2025-09-25 22:23:23 Re: Remove unused parameter on check_and_push_window_quals
Previous Message David Rowley 2025-09-25 21:50:38 Re: Remove unused parameter on check_and_push_window_quals