lock_timeout GUC patch

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Hans-Juergen Schoenig <postgres(at)cybertec(dot)at>, Josh Berkus <josh(at)agliodbs(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Sándor Miglécz <sandor(at)cybertec(dot)at>, Andres Freund <andres(at)anarazel(dot)de>
Subject: lock_timeout GUC patch
Date: 2010-01-11 21:35:49
Message-ID: 4B4B99B5.70709@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

and I am happy to present the newest patch. Current state is
that it doesn't segfault and seems to work as expected.
These combinations below were tested.

The lock type on the left side of the arrow is taked by transaction 1
then transaction 2 tries to take the lock on the right side of the arrow.

LOCK TABLE -> LOCK TABLE = xact 2 times out
LOCK TABLE -> SELECT FOR UPDATE = xact 2 times out
LOCK TABLE -> SELECT FOR SHARE = xact 2 times out
LOCK TABLE -> SELECT (no lock) = xact 2 times out

SELECT FOR UPDATE -> LOCK TABLE = xact 2 times out
SELECT FOR UPDATE -> SELECT FOR UPDATE = xact 2 times out
SELECT FOR UPDATE -> SELECT FOR SHARE = xact 2 times out
SELECT FOR UPDATE -> SELECT (no lock) = xact 2 returns record

SELECT FOR SHARE -> LOCK TABLE = xact 2 times out
SELECT FOR SHARE -> SELECT FOR UPDATE = xact 2 times out
SELECT FOR SHARE -> SELECT FOR SHARE = xact 2 returns record
(+ UPDATE on xact 1 times out)
SELECT FOR SHARE -> SELECT (no lock) = xact 2 returns record

SELECT (no lock) -> LOCK TABLE = xact 2 times out
SELECT (no lock) -> SELECT FOR UPDATE = xact 2 returns record
SELECT (no lock) -> SELECT FOR SHARE = xact 2 returns record
SELECT (no lock) -> SELECT (no lock) = xact 2 returns record

Comments?

Best regards,
Zoltán Böszörményi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/

Attachment Content-Type Size
5-pg85-locktimeout-11-ctxdiff.patch text/x-patch 88.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2010-01-11 22:16:47 Re: Typed tables
Previous Message Martijn van Oosterhout 2010-01-11 21:30:07 Re: Testing with concurrent sessions