| From: | "Chee Wooson" <wuqi(at)vastdata(dot)com(dot)cn> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | chee(dot)wooson <chee(dot)wooson(at)gmail(dot)com> |
| Subject: | [PATCH] Discard aborted updaters when expanding a multixact |
| Date: | 2026-09-15 10:36:52 |
| Message-ID: | 5778D6297D3CCF21+202609151836512678486@vastdata.com.cn |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
An updating member of a multixact can be marked aborted in pg_xact while
its backend is still present in ProcArray. A concurrent update need not
wait for that member, but MultiXactIdExpand() currently retains it because
TransactionIdIsInProgress() still returns true. Adding the concurrent
updater then fails with:
ERROR: new multixact has more than one updating member
The relevant interleaving is:
1. One transaction updates a row.
2. A second transaction takes a compatible key-share lock, changing the
row's xmax into a multixact containing the updater and locker.
3. The updater records its abort in pg_xact, but has not yet been removed
from ProcArray.
4. A third transaction updates the row. The conflict check ignores the
aborted updater, but multixact expansion retains it as apparently
running and tries to add another updater.
The first patch discards an updating member when pg_xact already records
its abort, even if it still appears to be running. An abort status is
final. The existing checks for running and committed members remain in
place, so an updater whose backend crashed without recording an abort is
still discarded.
I reproduced this problem with a TPC-C test. The same failure was reported
in the 2022 thread "Fix for visibility check on 14.5 fails on tpcc with high
concurrency":
That report showed the same error and WAL records for an updater that
aborted before the next update.
Patch 0002 adds an injection point and an isolation test that reproduce
the race deterministically.
Regards,
Chee Wooson
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Discard-aborted-updaters-in-MultiXactIdExpand.patch | application/octet-stream | 1.6 KB |
| v1-0002-Test-multixact-expansion-during-updater-abort.patch | application/octet-stream | 5.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Salma El-Sayed | 2026-09-15 10:42:42 | Re: [GSoC 2026] - B-tree Index Bloat Reduction - Approach & Questions |
| Previous Message | Peter Eisentraut | 2026-09-15 10:36:40 | Re: FOR PORTION OF code review |