| From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | shveta malik <shveta(dot)malik(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE |
| Date: | 2026-04-28 01:40:00 |
| Message-ID: | CALj2ACWT0bT3Nr3FtW=9w0y6nbtt_yx9sqNsKyv4GeYmhsaU_Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Mon, Apr 27, 2026 at 3:01 AM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> I've 2 comments:
Thank you for reviewing!
> 1/ What about having just one curr_idx increment? (right after list_nth(),
> before the skip checks). I think that would be less error-prone if new skip
> conditions are added later.
Done.
> 2/ I think that the test is racy and could also succeed even without the fixes.
> Indeed, I think that the drops can complete before any concurrent polling
> happens (I can see it by adding a pg_sleep(2) before the first poll in the DO
> block). What about using an injection point to ensure a relation is removed
> during the polling?
I initially considered an injection point but chose polling since the
TAP test reproduced the bug consistently with hundreds of tables on my
dev system. I've now added an injection point for predictability.
I adjusted the commit message a bit. Please find the attached v3 patch
for further review. Thank you!
--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Fix-pg_get_publication_tables-race-with-concurren.patch | application/x-patch | 7.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Smith | 2026-04-28 01:57:00 | Re: Redundant/mis-use of _(x) gettext macro? |
| Previous Message | Bharath Rupireddy | 2026-04-28 01:30:00 | Re: [Proposal] pg_stat_wal_records – per-record-type WAL generation statistics |