Re: simplify register_dirty_segment()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: simplify register_dirty_segment()
Дата
Msg-id 28214.1114493555@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: simplify register_dirty_segment()  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
Список 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 по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: DO INSTEAD and conditional rules
Следующее
От: Mark Kirkwood
Дата:
Сообщение: Re: [PATCHES] Continue transactions after errors in psql