Re: README.tuplock and SHARE lock

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Will Mortensen <will(at)extrahop(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Yvonne Chen <yvonne(at)extrahop(dot)com>
Subject: Re: README.tuplock and SHARE lock
Date: 2024-11-19 08:55:49
Message-ID: 202411190855.atjovlceb7yu@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-Nov-19, Alvaro Herrera wrote:

> Hmm, yeah, it seems you're correct about this being an oversight -- we
> don't necessarily use a multixact if all we want to do is to store a FOR
> SHARE lock.

The "Infomask Bits" section explains correctly. I propose the following
amendment,

diff --git a/src/backend/access/heap/README.tuplock b/src/backend/access/heap/README.tuplock
index 31c52ad28f9..843c2e58f92 100644
--- a/src/backend/access/heap/README.tuplock
+++ b/src/backend/access/heap/README.tuplock
@@ -70,13 +70,8 @@ KEY SHARE conflict

When there is a single locker in a tuple, we can just store the locking info
in the tuple itself. We do this by storing the locker's Xid in XMAX, and
-setting infomask bits specifying the locking strength. There is one exception
-here: since infomask space is limited, we do not provide a separate bit
-for SELECT FOR SHARE, so we have to use the extended info in a MultiXact in
-that case. (The other cases, SELECT FOR UPDATE and SELECT FOR KEY SHARE, are
-presumably more commonly used due to being the standards-mandated locking
-mechanism, or heavily used by the RI code, so we want to provide fast paths
-for those.)
+setting infomask bits specifying the locking strength. See "Infomask Bits"
+below for details on the bit patterns we use.

MultiXacts
----------

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Ellos andaban todos desnudos como su madre los parió, y también las mujeres,
aunque no vi más que una, harto moza, y todos los que yo vi eran todos
mancebos, que ninguno vi de edad de más de XXX años" (Cristóbal Colón)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Will Mortensen 2024-11-19 08:59:22 Re: README.tuplock and SHARE lock
Previous Message jian he 2024-11-19 08:52:28 Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row