Re: Proposal: New LWLockmode LW_OWNER

From: "Jignesh K(dot) Shah" <J(dot)K(dot)Shah(at)Sun(dot)COM>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal: New LWLockmode LW_OWNER
Date: 2008-06-06 17:57:04
Message-ID: 48497A70.207@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> "Jignesh K. Shah" <J(dot)K(dot)Shah(at)Sun(dot)COM> writes:
>
>> New Lock Mode Proposed: LW_EX_OWNER (input on better name will be
>> appreciated).
>>
>
> This seems rather crazy, and you haven't actually given a single
> convincing use-case. Shouldn't you be trying to break down a lock
> into multiple locks instead of inventing new lock semantics that
> nobody really understands?
>
>

One area that I find it useful is where it will be useful is in
ProcArrayEndTransaction where it uses exclusive to update proc array
structure where right now it uses EXCLUSIVE and most commit transactions
are updating their own proc array structure this lock semantic can be
useful.. However I havent figured out on the last line where it updates
ShmemVariableCache->latestCompletedXid which might require still an
EXCLUSIVE lock and hence did not propose the use case.

http://doxygen.postgresql.org/procarray_8c-source.html#l00231

The whole concept of a single Exclusive lock to me is more flawed than
the proposed idea. Single Exclusive locks are artificial bottlenecks in
PostgreSQL and thats why a new lock semantic is helpful in opening
people's mind beyond exclusive lock and suddenly people will start doing
more parallel work where possible and LW_EX_OWNER allows that to work.
Which infact will allow somebody else to innovate on
ProcArrayEndTransaction and solve the problem that I could not figure
regarding latestCompletedXid.

In my sample test where putting LW_EX_OWNER or LW_OWNER as I have it my
code in ProcArrayEndTransaction the throughput of HEAD CVS went from
200,000 transactions per minute to 300,000 transactions per minute but
though in my case latestCompletedXid is unsafe. If thats solved, there
is a potential upswing in scalability in PostgreSQL core.

Once that function is implemented correctly, it will highlight other
places where such lock semantics could prove to be useful.. (My money on
WALInsertLock)

-Jignesh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-06-06 17:58:53 Re: Proposal: New LWLockmode LW_OWNER
Previous Message Greg Sabino Mullane 2008-06-06 17:54:06 Re: Overhauling GUCS