Re: [PATCH] Fix vacuum_delay_point happening inside lock

From: Neil Chen <carpenter(dot)nail(dot)cz(at)gmail(dot)com>
To: Kevin Rocker <me(at)kevinrocker(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix vacuum_delay_point happening inside lock
Date: 2026-08-04 00:38:46
Message-ID: CAA3qoJkJCyP--SZmbQfH7RC7_YiqZv6iVfQ232hLXyo95-=mQw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Kevin,

On Mon, Aug 3, 2026 at 11:21 PM Kevin Rocker <me(at)kevinrocker(dot)com> wrote:

> Hi Neil,
>
> The `LockBuffer(buffer, GIN_UNLOCK)` you mentioned does call the vacuum
> delay as part of inserting each entry to disk, so the gain would be one
> additional delay_point before the scan and the first insertion. That unlock
> is also only in the flush-to-disk path, so it's not a direct replacement
> for the removed one.
>
> The unconditional part of the loop is 'processPendingPage' then release
> the buffer and call vacuum_delay right after the if/else. Given all that,
> it's probably fine as is? Let me know what you think. I've attached a patch
> with your suggestion as well.
>
> - Kevin Rocker

Thanks, that makes sense. I agree that the original patch is sufficient.

The additional call could improve cancellation responsiveness in the narrow
case where an interrupt becomes pending before the flush, but that window is
probably small, and the existing per-entry delay points already cover the
long-running part. So I have no objection to keeping the patch as is.

Best regards,
--
Ze Chen (Neil)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-08-04 00:41:52 Re: Add a hook for handling logical decoding messages on subscribers.
Previous Message Quan Zongliang 2026-08-04 00:31:11 Re: [PATCH] Remove unused PartitionDescData.last_found_part_index field