Re: [COMMITTERS] pgsql-server: Rearrange pg_subtrans handling - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [COMMITTERS] pgsql-server: Rearrange pg_subtrans handling
Date
Msg-id 28790.1093325897@sss.pgh.pa.us
Whole thread Raw
In response to Re: [COMMITTERS] pgsql-server: Rearrange pg_subtrans  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: [COMMITTERS] pgsql-server: Rearrange pg_subtrans handling  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List pgsql-hackers
Stephan Szabo <sszabo@megazone.bigpanda.com> writes:
> On Tue, 24 Aug 2004, Christopher Kings-Lynne wrote:
>> OK, what I mean is to know if a row is locked by any backend, why can't
>> we just put a reference count of the number of locks on that row,
>> instead of recording each backend separately?  Wouldn't that require a
>> fixed amount of shared mem?

> AFAICT you have to do something on top of that to allow deadlock
> detection.  If transaction X has a shared row lock on A and is waiting on
> a lock for me and I want to get an exclusive row lock on A, how do I
> detect that it's a deadlock?

I think the speed complaint I was just raising could possibly be
answered by setting an infomask bit indicating that the row might
be present in a separate table of active row locks.  (I'm not sure
how the bit would get cleared without race conditions, but let's
suppose that can be done.)  A little hashing, a little spill-to-disk
logic, and it might be done.  But that's just handwaving... anyone
want to try to fill in the details?

[ But to answer Chris' question: no, I don't see any way that this
could be a fixed-size table.  You will need that spill-to-disk bit. ]
        regards, tom lane


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: 8.0 beta 1 on linux-mipsel R5900
Next
From: Tom Lane
Date:
Subject: Re: AT TIME ZONE