Re: Idea for fixing the Windows fsync problem

From: "Takayuki Tsunakawa" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "Magnus Hagander" <magnus(at)hagander(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Idea for fixing the Windows fsync problem
Date: 2007-01-18 02:09:53
Message-ID: 019301c73aa5$bde05900$19527c0a@OPERAO
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> It's still not 100% bulletproof, because it's possible that some
other
> backend is holding an open file in the database as a consequence of
> having had to dump some shared buffer for itself, but that should be
> pretty darn rare if the bgwriter is getting its job done.

I've understood that you are talking about the case where backends
have to evict dirty buffers containing data of a database they are not
connected to. The problem is that the backends don't close the data
file after writing dirty buffers.
Then, how about making the backends close the data files? Concretely,
in FlushBuffer() in src/backend/storage/buffer/bufmgr.c, call
SmgrClose() after SmgrWrite() like this:

--------------------------------------------------
if (reln passed to FlushBuffer() was NULL &&
reln->smgr_rnode.dbNode != my database's oid(where is this
stored?)
SmgrClose(reln);
}
--------------------------------------------------

Or, to make the intention clearer, it may be better to add calls to
SmgrOpen() and SmgrClose() in succession after FlushBuffer() in
BufferAlloc().

BTW, fsync() is causing trouble here in addition to load-distributed
checkpoint that Itagaki-san has been addressing, isn't it? If fsync
were eliminated by using O_SYNC as commercial databases, Tom-san
didn't have to make efforts to solve this problem.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2007-01-18 02:20:08 Re: [COMMITTERS] pgsql: Fix failure due to accessing an
Previous Message Gavin Sherry 2007-01-18 00:53:13 Re: Design notes for EquivalenceClasses