Re: WAL: O_DIRECT and multipage-writer

From: ITAGAKI Takahiro <itagaki(at)tiara(dot)ocn(dot)ne(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WAL: O_DIRECT and multipage-writer
Date: 2005-01-26 13:06:46
Message-ID: 20050126203831.8736.ITAGAKI@tiara.ocn.ne.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message noman naeem 2005-01-26 13:20:51 Re: how to add a new column in pg_proc table
Previous Message Tommi Maekitalo 2005-01-26 11:50:34 IBM patent

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2005-01-26 14:10:38 Multi-table truncate
Previous Message Neil Conway 2005-01-26 08:28:03 Re: add soundex difference function to contrib/fuzzystrmatch