Why BgWriterDelay is fixed?

From: 高健 <luckyjackgao(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Why BgWriterDelay is fixed?
Date: 2012-10-29 07:17:10
Message-ID: CAL454F0ak34twvD75S0ZsB_1=6kJME5g1vY3WGzbyL9iE+s8kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In src/backend/postmaster/bgwriter.c , I can find the following source
code(PostgreSQL9.2):

/*
* 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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Seref Arikan 2012-10-29 08:07:28 Access to postgresql query optimizer output
Previous Message Tianyin Xu 2012-10-29 06:44:24 Re: How to print application_name in log_line_prefix (using %a)?