Re: Scaling XLog insertion (was Re: Moving more work outside WALInsertLock) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Scaling XLog insertion (was Re: Moving more work outside WALInsertLock)
Date
Msg-id 13352.1330967846@sss.pgh.pa.us
Whole thread Raw
In response to Re: Scaling XLog insertion (was Re: Moving more work outside WALInsertLock)  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Scaling XLog insertion (was Re: Moving more work outside WALInsertLock)  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> On 21.02.2012 13:19, Fujii Masao wrote:
>> In some places, the spinlock "insertpos_lck" is taken while another
>> spinlock "info_lck" is being held. Is this OK? What if unfortunately
>> inner spinlock takes long to be taken?

> Hmm, that's only done at a checkpoint (and a restartpoint), so I doubt 
> that's a big issue in practice. We had the same pattern before the 
> patch, just with WALInsertLock instead of insertpos_lck. Holding a 
> spinlock longer is much worse than holding a lwlock longer, but 
> nevertheless I don't think that's a problem.

No, that's NOT okay.  A spinlock is only supposed to be held across a
short straight-line sequence of instructions.  Something that could
involve a spin loop, or worse a sleep() kernel call, is right out.
Please change this.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Patch review for logging hooks (CF 2012-01)
Next
From: Simon Riggs
Date:
Subject: Re: archive_keepalive_command