From: | Amit Kapila <amit(dot)kapila(at)huawei(dot)com> |
---|---|
To: | "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "'Josh Berkus'" <josh(at)agliodbs(dot)com> |
Cc: | "'Alvaro Herrera'" <alvherre(at)2ndquadrant(dot)com>, "'Greg Smith'" <greg(at)2ndquadrant(dot)com>, <pgsql-hackers(at)postgresql(dot)org>, "'Fujii Masao'" <masao(dot)fujii(at)gmail(dot)com>, "'Robert Haas'" <robertmhaas(at)gmail(dot)com> |
Subject: | Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review]) |
Date: | 2013-07-23 05:01:40 |
Message-ID: | 004c01ce8761$b8a4ab20$29ee0160$@kapila@huawei.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Tuesday, July 23, 2013 5:26 AM Tom Lane wrote:
> Josh Berkus <josh(at)agliodbs(dot)com> writes:
> > Christophe just discovered something with include files which is
> going
> > to cause issues with ALTER SYSTEM SET.
>
> > So, take as a hypothetical that you use the default postgresql.conf
> > file, which sets shared_buffers = 32MB.
>
> > Instead of editing this file, you do ALTER SYSTEM SET shared_buffers
> =
> > '1GB', which updates config/postgresql.auto.conf.
>
> > Then you restart PostgreSQL.
>
> > Everything is hunky-dory, until a later occasion where you *reload*
> > postgresql.
>
> Everything was already *not* hunky-dory as soon as you did that, since
> a SIGHUP would have had the same problem.
>
> I'd be inclined to think that ALTER SYSTEM SET should not be allowed to
> modify any PGC_POSTMASTER parameters.
One way to fix the problem is that while parsing if the option already
exists, replace it.
Something like below code
ParseConfigFp()
{
..
..
/* replace the option value, if already exists in list */
for (item = *head_p; item != NULL; item =
item->next)
{
if (strcmp(item->name, opt_name) == 0)
{
pfree(item->value);
item->value = pstrdup(opt_value);
replaced = true;
break;
}
}
if(!replaced)
{
/* ordinary variable, append to list */
item = palloc(sizeof *item);
item->name = opt_name;
item->value = opt_value;
item->filename = pstrdup(config_file);
item->sourceline = ConfigFileLineno-1;
item->next = NULL;
if (*head_p == NULL)
*head_p = item;
else
(*tail_p)->next = item;
*tail_p = item;
}
..
..
}
There is overhead of traversing the list each time, but as this path is
traversed in less and non-performance critical operations, it can be
considered to fix the problem.
If you consider above as a non-trivial or not a right way to fix the
problem,
then I can update the patch to disallow PGC_POSTMASTER parameters by ALTER
SYSTEM SET command.
With Regards,
Amit Kapila.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-07-23 05:08:26 | Re: proposal - psql - show longest tables |
Previous Message | Tom Lane | 2013-07-23 04:52:19 | Re: Auto explain target tables |