Re: Why SyncOneBuffer does not called frequently? - Mailing list pgsql-general

From Jeff Janes
Subject Re: Why SyncOneBuffer does not called frequently?
Date
Msg-id CAMkU=1zstxGAfrLEcJcLD_Ls97qEghjnXrgvzQhTvFo3iWqSvg@mail.gmail.com
Whole thread Raw
In response to Why SyncOneBuffer does not called frequently?  (高健 <luckyjackgao@gmail.com>)
List pgsql-general
On Wed, Oct 31, 2012 at 1:53 AM, 高健 <luckyjackgao@gmail.com> wrote:
> Hi all:
>
> I am trying to understand when the bgwriter is written.
>
> I thought that the  bgwriter.c's calling turn is:
>
> BackgroundWriterMain ->BgBufferSync-> SyncOneBuffer

SyncOneBuffer is called with skip_recently_used true, so the buffer
will not get written by the background writer if it is was recently
used.

>
> And In my postgresql.conf , the bgwriter_delay=200ms.
>
> I did the following:
>
> postgres=# select * from testtab;
>  id |  val
> ----+-------
>   1 | 12345
> (1 row)
>
> postgres=# update testtab set val='54321' where id=1;
> UPDATE 1
> postgres=# select * from testtab;
>  id |  val
> ----+-------
>   1 | 54321
> (1 row)
>
> postgres=#
>
> Now I can say the buffer is dirty ,right?

It is dirty, but it also has a positive usagecount.

Are you sure it is that SyncOneBuffer is not getting called, rather
than it is getting called but returning before doing the write?

Cheers,

Jeff


pgsql-general by date:

Previous
From: Moshe Jacobson
Date:
Subject: Re: Parallel Insert and Delete operation
Next
From: Christian Hammers
Date:
Subject: When do archived WAL files gets removed after wal_keep_segments changed?