Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-25 Thread Andres Freund
On 2016-05-25 17:24:22 -0400, Robert Haas wrote: > On Wed, May 25, 2016 at 3:26 PM, Andres Freund wrote: > > On 2016-05-25 11:15:37 -0700, Andres Freund wrote: > >> On 2016-05-25 14:09:43 -0400, Robert Haas wrote: > >> I don't think anybody was doing that? The first questions

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-25 Thread Robert Haas
On Wed, May 25, 2016 at 3:26 PM, Andres Freund wrote: > On 2016-05-25 11:15:37 -0700, Andres Freund wrote: >> On 2016-05-25 14:09:43 -0400, Robert Haas wrote: >> I don't think anybody was doing that? The first questions on this thread >> were about upgrading and retesting... >

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-25 Thread Andres Freund
Hi, On 2016-05-24 06:03:07 +, Tsunakawa, Takayuki wrote: > At that time, many backend processes (I forgot the number) were acquiring and > releasing share mode lock on ProcArrayLock, most of which were from > TransactionIsInProgress(). FWIW, I suspect that 9.6 might be a fair bit better

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-25 Thread Andres Freund
On 2016-05-25 11:15:37 -0700, Andres Freund wrote: > On 2016-05-25 14:09:43 -0400, Robert Haas wrote: > I don't think anybody was doing that? The first questions on this thread > were about upgrading and retesting... Something I've repeatedly wondered about around this topic is whether we could

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-25 Thread Andres Freund
On 2016-05-25 14:09:43 -0400, Robert Haas wrote: > I think this is looking at the problem from the wrong angle. The OP's > complaint is pretty fair: a 30-second wait for ProcArrayLock is > horrendous, and if that's actually something that is happening with > any significant regularity on

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-25 Thread Robert Haas
On Tue, May 24, 2016 at 6:50 PM, Andres Freund wrote: > Now we potentially could mark individual lwlocks as being fair > locks. But which ones would those be? Certainly not ProcArrayLock, it's > way too heavily contended. I think this is looking at the problem from the wrong

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Tsunakawa, Takayuki
From: pgsql-hackers-ow...@postgresql.org [mailto:pgsql-hackers-ow...@postgresql.org] On Behalf Of Alexander Korotkov I've already observed such behavior, see [1]. I think that now there is no consensus on how to fix that. For instance, Andres express opinion that this shouldn't be fixed from

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Peter Geoghegan
On Tue, May 24, 2016 at 3:50 PM, Andres Freund wrote: >> Jim Gray's paper on the "Convoy phenomenon" remains relevant, decades later: >> >> http://www.msr-waypoint.com/en-us/um/people/gray/papers/Convoy%20Phenomenon%20RJ%202516.pdf >> >> I could believe that there's a case to

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Andres Freund
On 2016-05-24 15:34:31 -0700, Peter Geoghegan wrote: > On Tue, May 24, 2016 at 1:38 PM, Ants Aasma wrote: > >> I've already observed such behavior, see [1]. I think that now there is no > >> consensus on how to fix that. For instance, Andres express opinion that > >> this

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Peter Geoghegan
On Tue, May 24, 2016 at 1:38 PM, Ants Aasma wrote: >> I've already observed such behavior, see [1]. I think that now there is no >> consensus on how to fix that. For instance, Andres express opinion that >> this shouldn't be fixed from LWLock side [2]. >> FYI, I'm planning

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Andres Freund
On 2016-05-24 17:20:48 -0400, Robert Haas wrote: > On Tue, May 24, 2016 at 4:39 PM, Ants Aasma wrote: > > On Tue, May 24, 2016 at 9:03 AM, Tsunakawa, Takayuki > > wrote: > >> I encountered a strange behavior of lightweight lock in PostgreSQL

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Robert Haas
On Tue, May 24, 2016 at 4:39 PM, Ants Aasma wrote: > On Tue, May 24, 2016 at 9:03 AM, Tsunakawa, Takayuki > wrote: >> I encountered a strange behavior of lightweight lock in PostgreSQL 9.2. >> That appears to apply to 9.6, too, as far as I

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Ants Aasma
On Tue, May 24, 2016 at 9:03 AM, Tsunakawa, Takayuki wrote: > I encountered a strange behavior of lightweight lock in PostgreSQL 9.2. That > appears to apply to 9.6, too, as far as I examine the code. Could you tell > me if the behavior is intended or needs

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Ants Aasma
On Tue, May 24, 2016 at 1:29 PM, Alexander Korotkov wrote: > On Tue, May 24, 2016 at 9:03 AM, Tsunakawa, Takayuki > wrote: >> Is this intentional, or should we make the later share-lockers if someone >> is in the wait queue? > > I've

Re: [HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Alexander Korotkov
Hi! On Tue, May 24, 2016 at 9:03 AM, Tsunakawa, Takayuki < tsunakawa.ta...@jp.fujitsu.com> wrote: > I encountered a strange behavior of lightweight lock in PostgreSQL 9.2. > That appears to apply to 9.6, too, as far as I examine the code. Could you > tell me if the behavior is intended or needs

[HACKERS] Is the unfair lwlock behavior intended?

2016-05-24 Thread Tsunakawa, Takayuki
Hello, I encountered a strange behavior of lightweight lock in PostgreSQL 9.2. That appears to apply to 9.6, too, as far as I examine the code. Could you tell me if the behavior is intended or needs fix? Simply put, the unfair behavior is that waiters for exclusive mode are overtaken by