Re: Memory ordering issue in LWLockRelease, WakeupWaiters, WALInsertSlotRelease - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Memory ordering issue in LWLockRelease, WakeupWaiters, WALInsertSlotRelease
Date
Msg-id 20140321215233.GD17111@alap3.anarazel.de
Whole thread Raw
In response to Re: Memory ordering issue in LWLockRelease, WakeupWaiters, WALInsertSlotRelease  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Responses Re: Memory ordering issue in LWLockRelease, WakeupWaiters, WALInsertSlotRelease
List pgsql-hackers
Hi,

I see you've committed this, cool. Sorry for not getting back to the
topic earlier..

On 2014-03-13 22:44:03 +0200, Heikki Linnakangas wrote:
> On 03/12/2014 09:29 PM, Andres Freund wrote:
> >On 2014-03-07 17:54:32 +0200, Heikki Linnakangas wrote:
> >>So there are some unexplained differences there, but based on these results,
> >>I'm still OK with committing the patch.
> >
> >So, I am looking at this right now.
> >
> >I think there are some minor things I'd like to see addressed:
> >
> >1) I think there needs to be a good sized comment explaining why
> >    WaitXLogInsertionsToFinish() isn't racy due to the unlocked read at
> >    the beginning of LWLockWait().
> 
> There's a comment inside LWLockWait(). I think that's the right place for
> it; it's LWLockWait() that's cheating by not acquiring the spinlock before
> reading lock->exclusive.

I don't find that argument convincing. After all it's only correct
because the API user does things in a particular way. So there should be
comment at the callsite to make sure that's not changed.

> >3) I am the wrong one to complain, I know, but the comments above struct
> >    WALInsertLock are pretty hard to read from th sentence structure.
> 
> Hmm, ok. I reworded that, I hope it's more clear now.

Yes, it is.

The committed version doesn't compile with LWLOCK_STATS...

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Why is autovacuum_freeze_max_age a postmaster setting?
Next
From: Tom Lane
Date:
Subject: Re: psql blows up on BOM character sequence