On Mon, Oct 29, 2012 at 12:17 AM, 高健 <luckyjackgao@gmail.com> wrote:
> In src/backend/postmaster/bgwriter.c , I can find the following source
> code(PostgreSQL9.2):
>
>
> /*
> * GUC parameters
> */
> int BgWriterDelay = 200;
The value hard coded into the C code is the starting value, or
default. It is not a constant.
Indeed, I don't think that value is even used. I think that upon
start-up, that value gets set to the default listed in the guc.c file
(which is also 200), and so the value listed in the bgwriter.c file is
merely a mnemonic to remind people editing the file what the default
value is.
> 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 ?
Doing so is the job of the "grand unified configuration" machinery, in
src/backend/utils/misc/guc.c
Cheers,
Jeff