> BTW, Hiroshi has noticed me an excellent point #3:
>
> >Session-1
> >begin;
> >update A ...;
> >
> >Session-2
> >begin;
> >select * fromB ..;
> > There's no PostgreSQL shared buffer available.
> > This backend has to force the flush of a free buffer
> > page. Unfortunately the page was dirtied by the
> > above operation of Session-1 and calls pg_fsync()
> > for the table A. However fsync() is postponed until
> > commit of this backend.
> >
> >Session-1
> >commit;
> > There's no dirty buffer page for the table A.
> > So pg_fsync() isn't called for the table A.
>
> Seems there's no easy solution for this. Maybe now is the time to give
> up my idea...
I hate to see you give up on this.
Don't tell me we fsync on every buffer write, and not just at
transaction commit? That is terrible.
What if we set a flag on the file descriptor stating we dirtied/wrote
one of its buffers during the transaction, and cycle through the file
descriptors on buffer commit and fsync all involved in the transaction.
We also fsync if we close a file descriptor and it was involved in the
transaction. We clear the "involved in this transaction" flag on commit
too.
-- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026