Re: Why SyncOneBuffer does not called frequently?

Поиск
Список
Период
Сортировка
От Xiong He
Тема Re: Why SyncOneBuffer does not called frequently?
Дата
Msg-id tencent_7D1FF17D6BD3013B0BC67173@qq.com
обсуждение исходный текст
Ответ на Why SyncOneBuffer does not called frequently?  (高健 <luckyjackgao@gmail.com>)
Список pgsql-general
This perhaps proves that the bgwriter  doesn't need to call the SyncOneBuffer again on the same buffer.<br /><br
/><div><divstyle="color:#909090;font-family:Arial Narrow;font-size:12px">------------------</div><div
style="font-size:14px;font-family:Verdana;color:#000;"><div><divstyle="font-family: 'lucida Grande', Verdana;
font-size:12px; line-height: 18px; ">Thanks&Regards,</div><div>Xiong He</div></div></div></div><div><div
style="font-size:12px;font-family: Arial Narrow;padding:2px 0 2px
0;">------------------ Original ------------------</div><divstyle="font-size:
12px;background:#efefef;padding:8px;"><div><b>From:</b> "Xiong He"<iihero@qq.com>;</div><div><b>Date: </b> Thu,
Nov1, 2012 07:40 AM</div><div><b>To: </b> "高健"<luckyjackgao@gmail.com>;
"pgsql-general"<pgsql-general@postgresql.org>;<wbr /></div><div></div><div><b>Subject: </b> Re: [GENERAL] Why
SyncOneBufferdoes not called frequently?</div></div><div><br /></div>HI, <br /><br />I just debug the code, find that
thefollowing stack will call the SyncOneBuffer.<br /><br />>    postgres.exe!SyncOneBuffer(int buf_id=2, char
skip_recently_used=0) Line 1640    C<br />     postgres.exe!BufferSync(int flags=64)  Line 1284 + 0xb bytes    C<br
/>    postgres.exe!CheckPointBuffers(int flags=64)  Line 1801 + 0x9 bytes    C<br />    
postgres.exe!CheckPointGuts(XLogRecPtrcheckPointRedo={...}, int flags=64)  Line 8129 + 0x9 bytes    C<br />    
postgres.exe!CreateCheckPoint(intflags=64)  Line 7977 + 0x11 bytes    C<br />     postgres.exe!CheckpointerMain()  Line
505+ 0x9 bytes    C<br />     postgres.exe!AuxiliaryProcessMain(int argc=2, char * * argv=0x002f6fb8)  Line 429    C<br
/>    postgres.exe!SubPostmasterMain(int argc=4, char * * argv=0x002f6fb0)  Line 4136 + 0x13 bytes    C<br />    
postgres.exe!main(intargc=4, char * * argv=0x002f6fb0)  Line 176 + 0xd bytes    C<br />    
postgres.exe!__tmainCRTStartup() Line 582 + 0x19 bytes    C<br />     postgres.exe!mainCRTStartup()  Line 399    C<br
/><br/>This is the check point background process.<br /><br /><br /><br /><div><div
style="color:#909090;font-family:ArialNarrow;font-size:12px">------------------</div><div
style="font-size:14px;font-family:Verdana;color:#000;"><div><divstyle="font-family: 'lucida Grande', Verdana;
font-size:12px; line-height: 18px; ">Thanks&Regards,</div><div style="font-family: 'lucida Grande', Verdana;
font-size:12px; line-height: 18px; ">Xiong He<br /><br /></div></div></div></div><div> </div><div><div><br
/></div><div><br/></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------
Original------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>From:
</b> "高健"<luckyjackgao@gmail.com>;</div><div><b>Date:</b> Wed, Oct 31, 2012 04:53 PM</div><div><b>To:
</b> "pgsql-general"<pgsql-general@postgresql.org>;<wbr /></div><div></div><div><b>Subject: </b> [GENERAL] Why
SyncOneBufferdoes not called frequently?</div></div><div><br /></div><div>Hi all:</div><div><br /></div><div>I am
tryingto understand when the bgwriter is written.</div><div><br /></div><div>I thought that the  bgwriter.c's calling
turnis:</div><div><br /></div><div>BackgroundWriterMain ->BgBufferSync-> SyncOneBuffer</div><div><br
/></div><div>AndIn my postgresql.conf , the bgwriter_delay=200ms.</div><div><br /></div><div>I did the
following:</div><div><br/></div><div>postgres=# select * from testtab;</div><div> id |  val
 </div><div>----+-------</div><div> 1 | 12345</div><div>(1 row)</div><div><br /></div><div>postgres=# update testtab
setval='54321' where id=1;</div><div>UPDATE 1</div><div>postgres=# select * from testtab;</div><div> id |  val
 </div><div>----+-------</div><div> 1 | 54321</div><div>(1 row)</div><div><br /></div><div>postgres=# </div><div><br
/></div><div>NowI can say the buffer is dirty ,right?</div><div><br /></div><div>I wait for a few minutes, I can found
bgwriter'sBackgroundWriterMain called BgBufferSync many times.</div><div><br /></div><div>But I can't find BgBufferSync
reallycall SyncOneBuffer to put the dirty data todisk.</div><div><br /></div><div>Untill I close the postgres process,
Ican find the SyncOneBuffer is called for many times.</div><div><br /></div><div>My question is: </div><div>Why even
thereare dirty buffer(s), the SyncOneBuffer is still not called?  </div><div>Is it violating the background writer's
purpose?</div><div><br /></div><div>Or the flushing to disk will be done untill  the amount of block/buffer is
satisfied?If so , what is it?</div><div><br /></div><div>Thanks in advance for any help</div></div></div> 

В списке pgsql-general по дате отправления:

Предыдущее
От: Edson Richter
Дата:
Сообщение: Re: dropdb breaks replication?
Следующее
От: "Xiong He"
Дата:
Сообщение: Re: Why PGDLLIMPORT is needed