Re: Make pg_prewarm, autoprewarm yield for waiting DDL

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Palak Chaturvedi <chaturvedipalak1911(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Make pg_prewarm, autoprewarm yield for waiting DDL
Date: 2026-09-02 23:22:00
Message-ID: CALj2ACVJDVwHVgYTPsZ+10RZJvZ3bGv5HC=rkC_CC-n_7AOJUw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Aug 17, 2026 at 6:44 AM Palak Chaturvedi
<chaturvedipalak1911(at)gmail(dot)com> wrote:
>
> I picked this up from the August CF and reproduced the CFBot "Test
> world" failure locally on postgres/master at 3d00537feb5 with 0001
> and 0002 applied. I am writing this as a review rather than a v3,
> since you said 0002 is not meant for commit.

Thanks for taking a look at it.

> The wait needs two things: the worker is paused at the injection
> point, and it currently holds AccessShareLock on t. If neither is
> true yet, wake the point so the worker advances to the next
> check. Something like:

I think passing the relation name as the injection point argument
(commit 0fd73cdffc1) makes the injection point fire only while the
worker is scanning the required table, so it can no longer pause on an
earlier relation and the race goes away. Does that work for you?

I moved the LockHasWaiters() fix needed from
https://commitfest.postgresql.org/patch/6732/ here and made it the
0001 patch.

I couldn't find a better way to make the test deterministic without a
large table, because the injection point can only be attached after
the restart when the worker is already scanning, so a long scan is
what gives the test enough time to attach before the worker finishes.
I'm open to thoughts here.

Please find the attached v3 patches.

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v3-0001-Fix-LockHasWaiters-crash-for-fast-path-locks.patch application/octet-stream 4.1 KB
v3-0002-Make-autoprewarm-yield-to-conflicting-lock-reques.patch application/octet-stream 6.4 KB
v3-0003-Add-test-for-autoprewarm-yielding-to-conflicting-.patch application/octet-stream 7.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-09-02 23:44:12 Re: SUM(int2)/SUM(int4) do not detect overflow of the int8 accumulator
Previous Message Michael Paquier 2026-09-02 23:21:49 Re: Remove fcinfo from statistics update internal functions