Search Postgresql Archives

Re: Why SyncOneBuffer does not called frequently?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HI,

I just debug the code, find that the following stack will call the SyncOneBuffer.

>    postgres.exe!SyncOneBuffer(int buf_id=2, char skip_recently_used=0)  Line 1640    C
     postgres.exe!BufferSync(int flags=64)  Line 1284 + 0xb bytes    C
     postgres.exe!CheckPointBuffers(int flags=64)  Line 1801 + 0x9 bytes    C
     postgres.exe!CheckPointGuts(XLogRecPtr checkPointRedo={...}, int flags=64)  Line 8129 + 0x9 bytes    C
     postgres.exe!CreateCheckPoint(int flags=64)  Line 7977 + 0x11 bytes    C
     postgres.exe!CheckpointerMain()  Line 505 + 0x9 bytes    C
     postgres.exe!AuxiliaryProcessMain(int argc=2, char * * argv=0x002f6fb8)  Line 429    C
     postgres.exe!SubPostmasterMain(int argc=4, char * * argv=0x002f6fb0)  Line 4136 + 0x13 bytes    C
     postgres.exe!main(int argc=4, char * * argv=0x002f6fb0)  Line 176 + 0xd bytes    C
     postgres.exe!__tmainCRTStartup()  Line 582 + 0x19 bytes    C
     postgres.exe!mainCRTStartup()  Line 399    C

This is the check point background process.



------------------
Thanks&Regards,
Xiong He

 


------------------ Original ------------------
From:  "¸ß½¡"<luckyjackgao@xxxxxxxxx>;
Date:  Wed, Oct 31, 2012 04:53 PM
To:  "pgsql-general"<pgsql-general@xxxxxxxxxxxxxx>;
Subject:  [GENERAL] Why SyncOneBuffer does not called frequently?

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux