Re: BUG #19760: CLUSTER loses a row the transaction inserted and then updated in a rolled-back subtransaction

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Zhijie Hou <houzhijie22(at)gmail(dot)com>
Cc: shihao zhong <zhong950419(at)gmail(dot)com>, Takeshi Ideriha <iderihatakeshi(at)gmail(dot)com>, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, alpkeles99(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19760: CLUSTER loses a row the transaction inserted and then updated in a rolled-back subtransaction
Date: 2026-10-22 23:42:14
Message-ID: atqfVnAaBcTPbqtK@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Oct 22, 2026 at 04:53:41PM +0800, Zhijie Hou wrote:
> +1 to fix that part first. That part of the fix (patch) looks clean to me. It
> also covers more common cases, which can happen for both user tables and
> catalogs, while the other part (the complicated, performance-sensitive one) only
> covers catalog cases IIUC, as user table DML holds locks until transaction end,
> so concurrent CLUSTER can't touch it in that case.

Please find attached a patch to do this part, for now.

> One idea to improve is to do these expensive checks only when xmin is not equal
> to xmax. If xmin is still in progress, xmax cannot be aborted, so it's safe to
> return early in that case. The DELETE test wouldn't regress after this change,
> since xmin and xmax differ there. The subxact_update test would still regress,
> but that's likely a rare case.

Yeah, the xmin <> xmax check would make sense here. I'd like to
suspect that you should be able to make back for most of the
performance regression of v2 with tweaks like that.

How does the attached look to you?
--
Michael

Attachment Content-Type Size
0001-Set-HEAP_XMAX_INVALID-for-tuples-updated-by-aborted-.patch text/plain 4.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message shihao zhong 2026-10-23 01:17:59 Re: BUG #19763: ManualBug2 NULL pointer dereference in make_build_data via examine_expression bypass of lookup_var_a
Previous Message Manu 2026-10-22 20:44:14 Re: BUG #19760: CLUSTER loses a row the transaction inserted and then updated in a rolled-back subtransaction