[PATCH] Fix vacuum_delay_point happening inside lock

From: "Kevin Rocker" <me(at)kevinrocker(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Fix vacuum_delay_point happening inside lock
Date: 2026-08-01 16:57:28
Message-ID: 492c6247-43d3-477b-8981-fb0c56767b38@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

ginInsertCleanup() calls vacuum_delay_point while still holding a lock on the current pending-list page, so the delay runs with interrupts held off.

This is the same problem 2d7f6947293 fixed in btbulkdelete() back in 2006, and it's related to 8a045f760f6 which went in last week.

The patch keeps the other vacuum_delay_point() calls that exist after the buffer is released, in both the flush branch and the main branch at the end of the loop.

I haven't seen this hang directly and this is my first contribution, so I'd appreciate a second opinion on anything. The issue exists in multiple supported branches, but should be easy to backpatch (happy to help with that).

The issue was surfaced by Opus, I've verified the logic against those two commits myself.

- Kevin Rocker

Attachment Content-Type Size
v1-0001-Don-t-call-vacuum_delay_point-while-holding-a-buf.patch text/x-patch 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Rachitskiy 2026-08-01 17:28:55 Re: [PATCH] Fix timeline history after recovery stops on an ancestor
Previous Message Alexander Lakhin 2026-08-01 16:00:00 xid_wraparound/002_limits.pl might fail due to transient warning