Re: XLogInsert scaling, revisited - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: XLogInsert scaling, revisited
Date
Msg-id 51E70093.1040907@vmware.com
Whole thread Raw
In response to Re: XLogInsert scaling, revisited  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On 17.07.2013 15:24, Andres Freund wrote:
> On 2013-07-17 15:46:00 +0530, Amit Kapila wrote:
>> Few doubts while reading the code:
>>
>> 1. Why in function WALInsertSlotAcquireOne(int slotno), it does
>> START_CRIT_SECTION() to
>>     Lock out cancel/die interrupts, whereas other places call
>> HOLD_INTERRUPTS()
>
> A crit section does more than just stopping interrupts. They also ensure
> that errors that occur while inside one get converted to a PANIC. That
> seems apt for SlotAcquire/Release. Although the comments could possibly
> improved a bit.

Agreed. The comment was copied from LWLockAcquire(), which only does 
HOLD_INTERRUPTS(). The crucial difference between LWLockAcquire() and 
WALInsertSlotAcquire() is that there is no automatic cleanup mechanism 
on abort for the WAL insertion slots like there is for lwlocks. Added a 
sentence to the comment to mention that.

>> 3.
>> static bool
>> ReserveXLogSwitch(..)
>>
>> In above function header, why EndPos_p/StartPos_p is used when
>> function arguments are EndPos/StartPos?
>
> I guess that's bitrot...

Yep, fixed.

Thanks for the review!

- Heikki



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: XLogInsert scaling, revisited
Next
From: Markus Wanner
Date:
Subject: Re: Proposal: template-ify (binary) extensions