XLogFlush

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: XLogFlush
Date: 2009-08-21 08:18:46
Message-ID: f67928030908210118v6de56085h89310307ee977170@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Maybe this is one of those things that is obvious when someone points
it out to you, but right now I am not seeing it. If you look at the
last eight lines of this snippet from XLogFlush, you see that if we
obtain WriteRqstPtr under the WALInsertLock, then we both write and
flush up to the highest write request. But if we obtain it under the
info_lck, then we write up to the highest write request but flush only
up to our own records flush request. Why the disparate treatment?
The effect of this seems to be that when WALInsertLock is busy, group
commits are suppressed.

if (LWLockConditionalAcquire(WALInsertLock, LW_EXCLUSIVE))
{
XLogCtlInsert *Insert = &XLogCtl->Insert;
uint32 freespace = INSERT_FREESPACE(Insert);
if (freespace < SizeOfXLogRecord) /* buffer is full */
WriteRqstPtr = XLogCtl->xlblocks[Insert->curridx];
else
{
WriteRqstPtr = XLogCtl->xlblocks[Insert->curridx];
WriteRqstPtr.xrecoff -= freespace;
}
LWLockRelease(WALInsertLock);
WriteRqst.Write = WriteRqstPtr;
WriteRqst.Flush = WriteRqstPtr;
}
else
{
WriteRqst.Write = WriteRqstPtr;
WriteRqst.Flush = record;
}

Cheers,

Jeff

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Matthews 2009-08-21 10:28:05 Geometric Elimination
Previous Message Nikhil Sontakke 2009-08-21 05:58:22 Re: UPDATE ... SET (a, b, c) = (expr)