Issue with PGC_BACKEND parameters

From: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Issue with PGC_BACKEND parameters
Date: 2013-06-14 12:03:47
Message-ID: 009801ce68f7$3a746340$af5d29c0$@kapila@huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I had observed one problem with PGC_BACKEND parameters while testing patch
for ALTER SYSTEM command.

Problem statement: If I change PGC_BACKEND parameters directly in
postgresql.conf and then do pg_reload_conf() and reconnect, it will
still show the old value.
Detailed steps
1. Start server with default settings
2. Connect Client
3. show log_connections; -- it will show as off, this is correct.
4. Change log_connections in postgresql.conf to on
5. issue command select pg_reload_conf() in client (which is started in
step-2)
6. Connect a new client
7. show log_connections; -- it will show as off, this is "in-correct".

The problem is in step-7, it should show as on.

This problem occur only in Windows.

The reason for this problem is that in WINDOWS, when a new session is
started it will load the changed parameters in new backend by
global/config_exec_params file. The flow is in
SubPostmasterMain()->read_nondefault_variables()->set_config_option().

In below code in function set_config_option(), it will not allow to change
PGC_BACKEND variable and even in comments it has mentioned that only
postmaster will be allowed to change and the same will propagate to
subsequently started backends, but this is not TRUE for Windows.

switch (record->context)
{
..
..
case PGC_BACKEND:
if (context == PGC_SIGHUP)
{
/*
* If a PGC_BACKEND parameter is changed in
the config file,
* we want to accept the new value in the
postmaster (whence
* it will propagate to subsequently-started
backends), but
* ignore it in existing backends.
This is a tad klugy, but
* necessary because we don't re-read the
config file during
* backend start.
*/
if (IsUnderPostmaster)
return -1;
}

}

I think to fix the issue we need to pass the information whether PGC_BACKEND
parameter is allowed to change in set_config_option() function.
One way is to pass a new parameter.

Kindly let me know your suggestions.

With Regards,
Amit Kapila.

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2013-06-14 12:15:08 Re: SPGist "triple parity" concept doesn't work
Previous Message Marko Kreen 2013-06-14 12:00:29 Re: MD5 aggregate