Re: [COMMITTERS] pgsql-server: Rearrange pg_subtrans handling

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql-server: Rearrange pg_subtrans handling
Date: 2004-08-24 05:38:17
Message-ID: 28790.1093325897@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-08-24 07:36:21 Re: [COMMITTERS] pgsql-server: Rearrange pg_subtrans handling
Previous Message Stephan Szabo 2004-08-24 05:05:19 Re: [COMMITTERS] pgsql-server: Rearrange pg_subtrans

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-08-24 05:55:25 Re: AT TIME ZONE
Previous Message Greg Stark 2004-08-24 05:36:52 Re: 8.0 beta 1 on linux-mipsel R5900