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

From 高健
Subject Why SyncOneBuffer does not called frequently?
Date
Msg-id CAL454F2Om3VY_5gvn4_VWfQ+4niKhqu7CpW6OJEFi+z_JwY8qg@mail.gmail.com
Whole thread Raw
Responses Re: Why SyncOneBuffer does not called frequently?
List pgsql-general
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

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?

I wait for a few minutes, I can found bgwriter's BackgroundWriterMain called BgBufferSync many times.

But I can't find BgBufferSync really call SyncOneBuffer to put the dirty data todisk.

Untill I close the postgres process, I can find the SyncOneBuffer is called for many times.

My question is: 
Why even there are dirty buffer(s), the SyncOneBuffer is still not called?  
Is it violating the background writer's purpose? 

Or the flushing to disk will be done untill  the amount of block/buffer is satisfied? If so , what is it?

Thanks in advance for any help

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to setup chained CA?
Next
From: Mahmoud Hakeem-Habeeb
Date:
Subject: Delay streaming replication using a paramter