Re: Why BgWriterDelay is fixed?
| От | Xiong He |
|---|---|
| Тема | Re: Why BgWriterDelay is fixed? |
| Дата | |
| Msg-id | tencent_4FE00EF0246CCCFE1C8C58E3@qq.com обсуждение исходный текст |
| Ответ на | Why BgWriterDelay is fixed? (高健 <luckyjackgao@gmail.com>) |
| Список | pgsql-general |
You can check the code in guc.c, search "bgwriter_delay", &BgWriterDelay
In the global user configuration, it can change the value of BgWriterDelay.
Since the BgWriterDelay declared in bgwriter.h as extern. It can be changed in the global namespace.
In src/backend/postmaster/bgwriter.c , I can find the following source code(PostgreSQL9.2):
In the global user configuration, it can change the value of BgWriterDelay.
Since the BgWriterDelay declared in bgwriter.h as extern. It can be changed in the global namespace.
------------------
Thanks&Regards,
Xiong He
------------------ Original ------------------
From: "高健"<luckyjackgao@gmail.com>;
Date: Mon, Oct 29, 2012 03:17 PM
To: "pgsql-general"<pgsql-general@postgresql.org>;
Subject: [GENERAL] Why BgWriterDelay is fixed?
/*
* GUC parameters
*/
int BgWriterDelay = 200;
...
rc = WaitLatch(&MyProc->procLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
BgWriterDelay /* ms */ );
...
if (rc == WL_TIMEOUT && can_hibernate && prev_hibernate)
{
/* Ask for notification at next buffer allocation */
StrategyNotifyBgWriter(&MyProc->procLatch);
/* Sleep ... */
rc = WaitLatch(&MyProc->procLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
BgWriterDelay * HIBERNATE_FACTOR);
/* Reset the notification request in case we timed out */
StrategyNotifyBgWriter(NULL);
}
But I also found the following in postgresql.conf:
#bgwriter_delay = 200ms # 10-10000ms between rounds
It is now comment .
But according to the fixed code of BgWriterDelay = 200, even when I update bgwriter_delay in postgresql.conf to a different value(eg 300ms),
how can it ovewrite the fixed 200ms in bgwriter.c ?
I also want to know, if it is not a bug, then what is the reason?
В списке pgsql-general по дате отправления: