Re: WALInsertLock tuning - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: WALInsertLock tuning
Date
Msg-id 4DEE457D.5050309@enterprisedb.com
Whole thread Raw
In response to Re: WALInsertLock tuning  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: WALInsertLock tuning
List pgsql-hackers
On 07.06.2011 10:55, Simon Riggs wrote:
> On Tue, Jun 7, 2011 at 8:27 AM, Heikki Linnakangas
> <heikki.linnakangas@enterprisedb.com>  wrote:
>> You would only need to do it just before you write out the WAL. I guess
>> you'd need to grab WALInsertLock in XLogWrite() to prevent more WAL records
>> from being inserted on the page until you're done zeroing it, though.
>
> How would that help?

It doesn't matter whether the pages are zeroed while they sit in memory. 
And if you write a full page of WAL data, any wasted bytes at the end of 
the page don't matter, because they're ignored at replay anyway. The 
possibility of mistaking random garbage for valid WAL only occurs when 
we write a partial WAL page to disk. So, it is enough to zero the 
remainder of the partial WAL page (or just the next few words) when we 
write it out.

That's a lot cheaper than fully zeroing every page. (except for the fact 
that you'd need to hold WALInsertLock while you do it)

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: SIREAD lock versus ACCESS EXCLUSIVE lock
Next
From: "Joshua D. Drake"
Date:
Subject: Re: reducing the overhead of frequent table locks - now, with WIP patch