Re: find_all_inheritors() with NoLock fails on concurrently dropped sub-partitions

From: surya poondla <suryapoondla4(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: find_all_inheritors() with NoLock fails on concurrently dropped sub-partitions
Date: 2026-10-14 21:53:43
Message-ID: CAOVWO5r31JQKoXc4f12GnGDmvq8AaNF_9_hod-tcDzSLk+1sTw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Zsolt,

Thanks for v2, it looks good to me.

I applied it on master and ran both test cases by hand, and also plain-leaf
versions with VACUUM, REPACK and LOCK TABLE. Everything
passes, and LOCK TABLE skips the dropped partition as expected. With the
fix disabled, both of your test cases fail with "cache lookup
failed" in has_subclass().

You're right about needing "a1". In my runs, with plain leaves the
pg_publication_tables case didn't fail even without the fix (the
dropped table was just left out), and the VACUUM case failed only when the
backend hadn't already cached the dropped table. So your test is the more
reliable one.

One note for back-patching, the test uses string conditions for injection
points, which only exist on master (0fd73cdffc1), so it
can't go to the back branches. The fix itself should back-patch with small
adjustments (an #include conflict on 18 and older, and 16 and
older have no utils/injection_point.h).

Otherwise I think this is ready for a committer to look at it.

Regards,
Surya Poondla

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-10-14 22:33:26 Re: REPACK: warn about skipping foreign partitions
Previous Message surya poondla 2026-10-14 21:45:18 Re: REPACK: warn about skipping foreign partitions