pgsql: Allow special SKIP LOCKED condition in Assert()

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow special SKIP LOCKED condition in Assert()
Date: 2022-01-04 16:02:23
Message-ID: E1n4mGV-0002Vh-Oh@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow special SKIP LOCKED condition in Assert()

Under concurrency, it is possible for two sessions to be merrily locking
and releasing a tuple and marking it again as HEAP_XMAX_INVALID all the
while a third session attempts to lock it, miserably fails at it, and
then contemplates life, the universe and everything only to eventually
fail an assertion that said bit is not set. Before SKIP LOCKED that was
indeed a reasonable expectation, but alas! commit df630b0dd5ea falsified
it.

This bug is as old as time itself, and even older, if you think time
begins with the oldest supported branch. Therefore, backpatch to all
supported branches.

Author: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
Discussion: https://postgr.es/m/CANbhV-FeEwMnN8yuMyss7if1ZKjOKfjcgqB26n8pqu1e=q0ebg@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6b681cd056bb8c821f8853463938070ce0dade8f

Modified Files
--------------
src/backend/access/heap/heapam.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2022-01-04 16:27:11 pgsql: Fix silly mistake in Assert
Previous Message Peter Eisentraut 2022-01-04 15:27:51 pgsql: pg_dump: Refactor dumpDatabase()