Re: Reducing some DDL Locks to ShareLock

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reducing some DDL Locks to ShareLock
Date: 2008-11-12 14:32:19
Message-ID: 1226500339.27904.345.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Tue, 2008-11-11 at 21:57 -0500, Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> > On Mon, 2008-11-10 at 19:15 -0500, Tom Lane wrote:
> >> The reason I was thinking about heap_lock_tuple is that it might provide
> >> a suitable defense against that case.
>
> > OK. Lock tuple works OK, but its the unlock that I'm worried about. How
> > would non-transactional un-lock tuple work?
>
> I was imagining that the heap_inplace_update operation would release the
> lock. Is there some problem with the concept?

Not the concept, just the mechanism.

Current tuple lock requestors do XactLockTableWait() which waits until
the lock on the transaction is released and removed from procarray.

The only way I can see to do this is by having another lock type, using
an additional info bit on t_infomask2. If that is set then we just wait
on a tuple lock, rather on the transaction lock. So we would add another
wait case into the heap_lock_tuple(), heap_update() and heap_delete().
Maybe NonXactLockTupleWait().

Requirement is to have anybody placing a non-transactional tuple lock to
already have a lock on relation. We would not need to WAL log this type
of lock, since we will require the lock holder to keep the buffer
pinned. The lock type would not need to be replayed for hot standby,

That OK, or do you see another way?

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2008-11-12 14:37:39 Re: array_length()
Previous Message Alvaro Herrera 2008-11-12 14:28:15 Re: Block-level CRC checks