Re: Increase of buffers usage count by bgwriter - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Increase of buffers usage count by bgwriter
Date
Msg-id 6879.1130342777@sss.pgh.pa.us
Whole thread Raw
In response to Increase of buffers usage count by bgwriter  (ITAGAKI Takahiro <itagaki.takahiro@lab.ntt.co.jp>)
Responses Re: Increase of buffers usage count by bgwriter
List pgsql-hackers
ITAGAKI Takahiro <itagaki.takahiro@lab.ntt.co.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: add_missing_from breaks existing views
Next
From: Grzegorz Piotr Jaskiewicz
Date:
Subject: Re: problem with custom Gist for custom type