Re: WAL: O_DIRECT and multipage-writer - Mailing list pgsql-hackers

From ITAGAKI Takahiro
Subject Re: WAL: O_DIRECT and multipage-writer
Date
Msg-id 20050126203831.8736.ITAGAKI@tiara.ocn.ne.jp
Whole thread Raw
In response to Re: [PATCHES] WAL: O_DIRECT and multipage-writer  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> What does XLOG_EXTRA_BUFFERS accomplish?

It is because the buffer passed to direct-io must be aligned to 
the same size of filesystem page, typically 4KB. Buffers allocated
with ShmemInitStruct are not necessarily aligned, so we need to allocate
extra buffers and align them by ourself.


> Also, I'm worried that you broke something by not updating
> Write->curridx immediately in XLogWrite.  There certainly isn't going
> to be any measurable performance boost from keeping that in a local
> variable, so why take any risk?

Keeping Write->curridx in a local variable is not for performance,
but for writing multiple pages at once.
I think it is ok to update Write->curridx at the end of XLogWrite,
because XLogCtl.Write.curridx will be touched by only one process
at a time. Process-shared variables are not modified until XLogWrite
is completed, so that other backends can write same contents later
even if the backend in XLogWrite is crushed. 


Sincerely,
ITAGAKI Takahiro



pgsql-hackers by date:

Previous
From: Tommi Maekitalo
Date:
Subject: IBM patent
Next
From: noman naeem
Date:
Subject: Re: how to add a new column in pg_proc table