Thread: Questions about bufmgr

Questions about bufmgr

From
"Hiroshi Inoue"
Date:
Hi all,

I'm trying to fix a TODO item
* spinlock stuck problem when elog(FATAL) and elog(ERROR) inside bufmgr
.
But it's more difficult than I have thought.
IO_ERROR stuff in bufmgr.c has never been executed before
because of spinlock stuck abort.
As far as I see,I would have to change it.
Please help me.

Now I have a question about IO_IN_PROGRESS handling.

IO_IN_PROGRESS mask and io_in_progress_lock spinlock
are held while BufferAlloc() reads disk pages into buffer.

But seems they aren't held while writing buffers to disk,
We couldn't detect writing_IO_IN_PROGRESS and simultaneous
writing to a same page may occur.
No problem ?


And I have other questions which are irrevalent to the TODO item.

1. Why does BufferReplace() call smgrflush()(not smgrwrite()) ?   Are there any reasons that we couldn't postpone
fsync()until   commit ?
 

2. Why does FlushRelationBuffers() call FlushBuffer() ?   Isn't it a overhead to call fsync() per page ?

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp


Re: [HACKERS] Questions about bufmgr

From
Vadim Mikheev
Date:
Hiroshi Inoue wrote:
> 
> I'm trying to fix a TODO item
> * spinlock stuck problem when elog(FATAL) and elog(ERROR) inside bufmgr

...

> And I have other questions which are irrevalent to the TODO item.
> 
> 1. Why does BufferReplace() call smgrflush()(not smgrwrite()) ?
>     Are there any reasons that we couldn't postpone fsync() until
>     commit ?
> 
> 2. Why does FlushRelationBuffers() call FlushBuffer() ?
>     Isn't it a overhead to call fsync() per page ?

Pleeease don't touch bufmgr for the moment - it will be
changed due to WAL implementation. Currently I do data 
base startup/shutdown stuff but will switch to bufmgr
in 1-2 days.

Vadim