| From: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> |
|---|---|
| To: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
| Cc: | Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19723: CREATE INDEX racing with ALTER INDEX ATTACH PARTITION triggers unexpected internal error |
| Date: | 2026-11-30 05:29:10 |
| Message-ID: | CAJTYsWX0bjcdvuDs=aBy0tD25-R4-ht7pKG0fMfXk0Ds-rz9Mw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi,
On Fri, 27 Nov 2026 at 00:01, Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
>
> On 2026-Sep-28, Rafia Sabih wrote:
>
> > I went through this patch and the fix looks good to me. However I see one
> > problem with this in the following scenario,
> > s1: BEGIN; ALTER INDEX c_a_idx RENAME TO c_renamed; -- c_a_idx attached
> > s2: CREATE INDEX pi_new ON p (a); -- now waits (used to complete)
> > s1: INSERT INTO c VALUES (1);
> > => ERROR: deadlock detected
> > Unpatched, both sessions complete.
>
> Yeah, well spotted.
>
> I'm not really sure about the unlocked check plus recheck though. Isn't
> it simpler to grab locks on all indexes first, and after the check
> release the ones we don't need? As attached. (The isolation test case
> now behaves differently)
Thanks for v3. I tried adding INSERT INTO pia_2 VALUES (11) before
s1c in the rename permutation, and it still hits the deadlock Rafia
reported. Without the INSERT, the test only checks that CREATE INDEX
waits. I also noticed that the break after a match leaves the remaining
indexes locked until commit.
Tried keeping the early has_superclass() skip and rechecking after
locking a candidate. That fixed the original race without either of
these regressions. In my fuzz test I could not see any more issues.
Regards,
Ayush
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-11-30 05:35:59 | Re: BUG #19873: planner silently drops the second ORDER BY sort key when both keys reference the same expression und |
| Previous Message | shihao zhong | 2026-11-30 05:25:34 | Re: BUG #19871: JSON_TABLE evaluates each PASSING argument once per column - a named variable $v gets different valu |