Re: Increase of buffers usage count by bgwriter

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Increase of buffers usage count by bgwriter
Date: 2005-10-26 16:06:17
Message-ID: 6879.1130342777@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp> writes:
> I found that bgwriter increments usage count of buffers when it writes
> the buffers. I feel this behavior is strange, because the behavior of
> bgwriter will affect buffer management strategy.

Good point --- we probably don't want it to do that.

> If the behavior is not intended, another UnpinBuffer that doesn't
> increase the buffers usage count will be needed.
> Otherwise, bgwriter should do behavior that looks like VACUUM,
> using StrategyHintVacuum(true).

I think it might be sufficient to not increment usage_count when
UnpinBuffer's "trashOK" parameter is false --- that's what
SyncOneBuffer passes, so it'd fix the issue for bgwriter activity,
and arguably all the other call sites that pass false also don't
want the count to increment.

(Probably need a different name for trashOK ...)

Comments?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Grzegorz Piotr Jaskiewicz 2005-10-26 16:29:12 Re: problem with custom Gist for custom type
Previous Message Tom Lane 2005-10-26 15:57:23 Re: add_missing_from breaks existing views