From 5aac7960f87988a9c41aaf9f27cf9edcdeb39868 Mon Sep 17 00:00:00 2001 From: Kevin Rocker Date: Mon, 28 Sep 2026 02:32:16 +0200 Subject: [PATCH v8 3/3] Assert that vacuum_delay_point() is called only when interruptible. A delay point may sleep and is expected to service query cancel, so it must not be reached where CHECK_FOR_INTERRUPTS() cannot act, e.g. with an LWLock or buffer content lock held. Enforce that in assert-enabled builds, so that a new call site in a locked region trips the buildfarm rather than silently delaying with interrupts held off. Author: Kevin Rocker Author: Neil Chen Suggested-by: Tom Lane Discussion: https://postgr.es/m/492c6247-43d3-477b-8981-fb0c56767b38%40app.fastmail.com --- src/backend/commands/vacuum.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index d8c2f33c615..b388c561cdb 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -2482,6 +2482,12 @@ vacuum_delay_point(bool is_analyze) { double msec = 0; + /* + * A delay point may sleep and must service query cancel, so it cannot be + * reached where CHECK_FOR_INTERRUPTS() would be a no-op. + */ + Assert(INTERRUPTS_CAN_BE_PROCESSED()); + /* Always check for interrupts */ CHECK_FOR_INTERRUPTS(); -- 2.54.0