On 07.06.2011 10:55, Simon Riggs wrote:
On Tue, Jun 7, 2011 at 8:27 AM, Heikki Linnakangas
<heikki.linnakan...@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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to