Tom Lane <[EMAIL PROTECTED]> 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


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to