Re: simplify register_dirty_segment() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: simplify register_dirty_segment()
Date
Msg-id 28214.1114493555@sss.pgh.pa.us
Whole thread Raw
In response to Re: simplify register_dirty_segment()  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
List pgsql-hackers
"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> I can't figure out why it tooks so long time in windows and SunOS for clean
> files -

I told you why: they don't maintain bookkeeping information that allows
them to quickly identify dirty buffers belonging to a particular file.
Linux does ... but I'm not sure that makes it "smarter", since that
bookkeeping has a distributed cost, and the cost might or might not
be repaid in any particular system workload.  It would be a reasonable
bet for a kernel designer to assume that fsync() is generally going to
have to wait for some I/O and so a bit of CPU overhead isn't really
going to matter.

> You are right. A possible (but not clean) solution is like this: The
> bgwriter maintain a refcount for each file. When the file is open,
> refcount++, when the file is closing, refcount--. When the refcount goes to
> zero, Bgwriter could safely remove it from its PendingOpsTable after
> checkpoint.

Adjusting such a global refcount would require global locks, which is
just what you were hoping to avoid :-(
        regards, tom lane


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: DO INSTEAD and conditional rules
Next
From: Mark Kirkwood
Date:
Subject: Re: [PATCHES] Continue transactions after errors in psql