Re: XLogInsert scaling, revisited

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>, Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
Cc: 'Jeff Janes' <jeff(dot)janes(at)gmail(dot)com>, 'Alvaro Herrera' <alvherre(at)2ndquadrant(dot)com>, 'PostgreSQL-development' <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: XLogInsert scaling, revisited
Date: 2013-07-17 20:37:39
Message-ID: 51E70093.1040907@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Markus Wanner 2013-07-17 20:41:34 Re: Proposal: template-ify (binary) extensions
Previous Message Heikki Linnakangas 2013-07-17 20:24:03 Re: XLogInsert scaling, revisited