Re: Assertion with aborted UPDATE in subtransaction

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: RekGRpth <rekgrpth(at)gmail(dot)com>
Cc: Lionel Hamayon <lionel(dot)hamayon(at)evolution-digitale(dot)fr>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Jasper Smit <jbsmit(at)gmail(dot)com>, Luc Vlaming Hummel <luc(dot)vlaming(at)servicenow(dot)com>, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
Subject: Re: Assertion with aborted UPDATE in subtransaction
Date: 2026-11-20 15:11:35
Message-ID: 8250f6eb-56b0-4188-b938-98f2b35d72c2@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/11/2026 07:28, RekGRpth wrote:
> Hi Heikki,
>
> I verified your patch against the scenario from my duplicate report [1],
> on a 19rc1 --enable-cassert build:
>
> - the minimal SQL repro from my report (SELECT ... FOR NO KEY UPDATE,
> subtransaction UPDATE, ROLLBACK TO + RELEASE SAVEPOINT, then a
> TOAST-sized UPDATE in the top transaction) now passes; on the
> unpatched build it trips Assert("HEAP_XMAX_IS_LOCKED_ONLY(
> infomask_lock_old_tuple)");
>
> - the real-world case where I originally hit this also passes: the
> pg_task extension retries its bookkeeping UPDATE in the top
> transaction after RollbackAndReleaseCurrentSubTransaction(), and
> that update goes through exactly this heap_update() temp-lock
> codepath (the task table update shows up in the log with the
> expected lock-only infomask, no TRAP);
>
> - with temporary elog() instrumentation at the assert site I confirmed
> the multixid now comes back pruned: the aborted updating member is
> removed, a fresh multixid is created, and the infomask has
> HEAP_XMAX_LOCK_ONLY set — where the unpatched code returned the
> original multixid unchanged (infomask without LOCK_ONLY).
>
> The combocid regression test from the patch passes too. So the patch
> fixes my case as well — thanks for picking this up!
>
> [1] https://www.postgresql.org/message-id/CAPgh2mJhTo2yq_vLrT6OZPn54hDxJpDVu=9L7Ay_M5qogNFuTw@mail.gmail.com
Ok, committed and backpatched that. Thanks everyone!

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-11-20 15:13:39 Re: ZSTD TOAST compression, and an extensible compression method encoding
Previous Message Greg Burd 2026-11-20 15:01:46 Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE)