Skip site navigation (1) Skip section navigation (2)

double-buffering page writes

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: double-buffering page writes
Date: 2008-10-21 16:04:37
Message-ID: 20081021160437.GA4001@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi,

I'm trying to see if it makes sense to do the double-buffering of page
writes before going further ahead with CRC checking.  I came up with the
attached patch; it does the double-buffering inconditionally, because as
it was said, it allows releasing the io_in_progress lock (and resetting
BM_IO_IN_PROGRESS) early.

So far I have not managed to convince me that this is a correct change
to make; the io_in_progress bits are pretty convoluted -- for example, I
wonder how does "releasing" the buffer early (before actually sending
the write to the kernel and marking it not dirty) interact with
checkpoint and a possible full-page image.

Basically the change is to take the unsetting of BM_DIRTY out of
TerminateBufferIO and into its own routine; and in FlushBuffer, release
io_in_progress just after copying the buffer contents elsewhere, and
mark the buffer not dirty after actually doing the write.

Thoughts?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment: dblbuf.patch
Description: text/x-diff (6.1 KB)

Responses

pgsql-hackers by date

Next:From: Simon RiggsDate: 2008-10-21 16:43:09
Subject: Re: pgsql: SQL 200N -> SQL:2003
Previous:From: Jim 'Decibel!' NasbyDate: 2008-10-21 15:45:43
Subject: Regression in IN( field, field, field ) performance

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group