Re: XLogInsert scaling, revisited

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
Cc: 'Heikki Linnakangas' <hlinnakangas(at)vmware(dot)com>, '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 12:24:59
Message-ID: 20130717122459.GC12343@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-07-17 15:46:00 +0530, Amit Kapila wrote:
> On Monday, July 08, 2013 2:47 PM Heikki Linnakangas wrote:
> > Ok, I've committed this patch now. Finally, phew!
>
> 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.

> 2. In function GetXLogBuffer(), why the logic to wakeup waiters is
> different when expectedEndPtr != endptr;
> When the wakeupwaiters is done in case expectedEndPtr == endptr?

I am not sure what you're asking here. We wakeup waiters if
expectedEndPtr != endptr because that means the wal buffer page the
'ptr' fits on currently has different content. Which in turn means we've
finished with the last page and progressed to a new one. So we wake up
everyone waiting for us.
WakeupWaiters() doesn't get passed expectedEndPtr but expectedEndPtr -
XLOG_BLCKSZ (up to there we are guaranteed to have inserted
successfully). And we're comparing with the xlogInsertingAt value which
basically measures up to where we've successfully inserted.

> 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...

Greetings,

Andres Freund

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2013-07-17 12:25:49 Re: Improvement of checkpoint IO scheduler for stable transaction responses
Previous Message Gurjeet Singh 2013-07-17 12:23:45 Re: review: Non-recursive processing of AND/OR lists