Re: [PATCH v2] Avoid carrying self lock-only xmax to updated tuple

From: João Rito <joaovictor(dot)rito(at)gmail(dot)com>
To: chee(dot)wooson(at)gmail(dot)com
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH v2] Avoid carrying self lock-only xmax to updated tuple
Date: 2026-11-18 18:40:32
Message-ID: CADMs5OP65HAzP==_tgMS6pzgaNn18LPjGPmw83=uz2nqrQ0L2A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Chee,

Thank you for v4. I tested it on master at 11591f273e6a (Debian container,
gcc 14.2, --enable-cassert --enable-debug --enable-tap-tests).

- Both patches apply with git apply, and git diff --check reports nothing.
The build has 0 warnings.
- make check: 243 of 243. Isolation: 139 of 139. contrib pageinspect (8),
amcheck (4, TAP 298 subtests), pgrowlocks (1), pg_visibility (1): all pass.
- 0001 is the same as v3 (only the subject line differs), so I did not
repeat my earlier tuple-state and concurrency scripts. They passed on v3.

I read the new README.tuplock text against heapam.c, and all four of my
earlier comments look addressed to me: the different-subtransaction and
MultiXact cases are now in the text, the test
HEAP_XMAX_IS_LOCKED_ONLY(infomask) && TransactionIdEquals(xwait, xid) is
shown, the HEAP_XMAX_ prefix is used everywhere, and the abort of the
subtransaction is explained through the xmin of the new version.
I found no factual error. Please correct me if I misread something.

What I did not test: check-world, injection points, other platforms (one
Linux build), standby and replication, pg_upgrade, a long concurrent load,
extensions that read xmax (pg_surgery, pgstattuple, pg_walinspect), deeper
nested subtransactions, and partitioned tables or FK triggers on many rows.
I only read the README text, there is no test for it.

Thanks again for the work.

Regards,
Joao Rito

On Tue, Nov 17, 2026 12:21 AM, Chee Wooson <chee(dot)wooson(at)gmail(dot)com> wrote:

> Hi Joao,
>
> My earlier v3 mail went only to you. Attached is v4, with the
> README.tuplock changes revised following your comments.
>
> The README now explains the general carry-forward mechanism before
> introducing the same-XID exception. It covers different-subtransaction
> lockers and MultiXact handling, shows the exact condition, uses consistent
> flag names, and explains why omitting the self-owned lock is safe even
> when the updating subtransaction aborts.
>
> Patch 0001 (code and regression test) is unchanged from v3.
> Only patch 0002 (README.tuplock) has changed.
>
> The core regression, isolation, and relevant contrib tests passed for
> the unchanged implementation.
>
> Thanks again for the testing and review.
>
> Regards,
> Chee Wooson
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2026-11-18 18:55:05 Re: Add ids to catalog/view columns in documentation
Previous Message Tristan Partin 2026-11-18 18:34:24 Add ids to catalog/view columns in documentation