Re: [WIP] shared locks

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [WIP] shared locks
Date: 2005-04-24 19:15:37
Message-ID: 20050424191537.GB30545@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Mon, Apr 18, 2005 at 08:00:57PM -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:
> > The idea is that a tuple's Xmax can either be a real TransactionId
> > (which is used normally like current CVS tip), or, if the infomask has
> > HEAP_XMAX_SHARED_LOCK, a MultiXactId.
>
> Interesting idea. Would it be possible to invoke this mechanism only
> when actually needed --- that is, the first locker of a given tuple
> puts his plain TransactionId into Xmax (and also sets an infomask bit
> indicating his intent to have a shared rather than exclusive lock),
> and then the second locker to come along replaces the TransactionId
> with a MultiTransactionId including himself and the first locker?

Ok, here is the patch again. I did this, so there are now two related
bits in the infomask: HEAP_XMAX_IS_MULTI and
HEAP_XMAX_{SHARED,EXCLUSIVE}_LOCK. (I ripped out HEAP_XMAX_FOR_UPDATE).
Locking and using a MultiXactId are orthogonal.

The rest is more or less the same that was in the original patch. I
feel this is in a OK state for review for possible inclusion. Some
testing is still needed regarding MultiXactId wraparound, and SLRU
truncation, and I haven't looked at whether documentation needs
updating.

--
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
Jude: I wish humans laid eggs
Ringlord: Why would you want humans to lay eggs?
Jude: So I can eat them

Attachment Content-Type Size
shared-locks-2.patch text/plain 105.6 KB
multixact.c text/plain 36.4 KB
multixact.h text/plain 1.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Hansen 2005-04-24 19:46:01 Re: [HACKERS] UNICODE/UTF-8 on win32
Previous Message Josh Berkus 2005-04-24 19:08:15 Re: [HACKERS] Bad n_distinct estimation; hacks suggested?

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-04-24 22:48:04 Re: Constant WAL replay
Previous Message Alvaro Herrera 2005-04-24 18:45:36 trivial whitespace correction in es.po