Re: Logging configuration changes [REVIEW]

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Logging configuration changes
Date: 2009-07-12 19:55:31
Message-ID: 200907122255.31856.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On occasion, I would have found it useful if a SIGHUP didn't only log *that*
it reloaded the configuration files, but also logged *what* had changed
(postgresql.conf changes in particular, not so much interested in
pg_hba.conf). Especially in light of the common mistake of forgetting to
uncomment a changed value, this would appear to be useful.

Comments?


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Logging configuration changes
Date: 2009-07-12 21:15:53
Message-ID: 603c8f070907121415t6a54c2adm82acbdac5ec18c14@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Jul 12, 2009 at 3:55 PM, Peter Eisentraut<peter_e(at)gmx(dot)net> wrote:
> On occasion, I would have found it useful if a SIGHUP didn't only log *that*
> it reloaded the configuration files, but also logged *what* had changed
> (postgresql.conf changes in particular, not so much interested in
> pg_hba.conf).  Especially in light of the common mistake of forgetting to
> uncomment a changed value, this would appear to be useful.
>
> Comments?

Sounds neat.

...Robert


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Logging configuration changes
Date: 2009-08-26 23:32:17
Message-ID: 1251329537.4418.21.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On sön, 2009-07-12 at 22:55 +0300, Peter Eisentraut wrote:
> On occasion, I would have found it useful if a SIGHUP didn't only log *that*
> it reloaded the configuration files, but also logged *what* had changed
> (postgresql.conf changes in particular, not so much interested in
> pg_hba.conf). Especially in light of the common mistake of forgetting to
> uncomment a changed value, this would appear to be useful.

Looked into this, looks trivial, except that this would log *all*
parameters that were set as a result of a reload, instead of only the
ones that changed. We don't have the information of what it was
previously readily available.

I think it would still be useful that way, but some people might find it
annoying.

Comments?


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Logging configuration changes
Date: 2009-08-27 02:13:11
Message-ID: 26173.1251339191@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> On sn, 2009-07-12 at 22:55 +0300, Peter Eisentraut wrote:
>> On occasion, I would have found it useful if a SIGHUP didn't only log *that*
>> it reloaded the configuration files, but also logged *what* had changed
>> (postgresql.conf changes in particular, not so much interested in
>> pg_hba.conf). Especially in light of the common mistake of forgetting to
>> uncomment a changed value, this would appear to be useful.

> Looked into this, looks trivial, except that this would log *all*
> parameters that were set as a result of a reload, instead of only the
> ones that changed. We don't have the information of what it was
> previously readily available.

> I think it would still be useful that way, but some people might find it
> annoying.

Seems to me it would be too chatty to be useful, at least for people who
set more than one or two things in postgresql.conf. Would it be that
hard to track which values actually changed? Without having looked at
the code, I'm thinking that much of the infrastructure must be there
already now that we have support for undoing commented-out settings.

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Logging configuration changes
Date: 2009-08-28 21:38:07
Message-ID: 1251495487.18151.12.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On ons, 2009-08-26 at 22:13 -0400, Tom Lane wrote:
> Seems to me it would be too chatty to be useful, at least for people who
> set more than one or two things in postgresql.conf. Would it be that
> hard to track which values actually changed? Without having looked at
> the code, I'm thinking that much of the infrastructure must be there
> already now that we have support for undoing commented-out settings.

Found an easy solution; see attached patch.

On a related note, I suggest reverting or revising this logging change:
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=293c816e4aad8e760bcb4eaba0aa16da0ccd2d04
Putting the reason for an error or warning into the detail part is not
acceptable style, IMO.

Attachment Content-Type Size
log-parameter-changes.diff text/x-patch 1.4 KB

From: Abhijit Menon-Sen <ams(at)toroid(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: Logging configuration changes [REVIEW]
Date: 2009-09-16 05:24:14
Message-ID: 20090916052414.GA3371@toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

(This is my review of the small patch Peter posted on 2009-08-29. See
http://archives.postgresql.org/message-id/1251495487.18151.12.camel@vanquo.pezone.net
for the original message.)

At 2009-08-29 00:38:07 +0300, peter_e(at)gmx(dot)net wrote:
>
> Found an easy solution; see attached patch.

Neat. The patch (a) applies to HEAD and builds correctly, (b) does what
it's supposed to, i.e. report parameters whose value has been changed or
reset to the default, and (c) seems sensible.

I can't help but think that it would be nice to report the default value
of a parameter that is reset (i.e. "parameter $x reset to default value
$y"). The first attached patch does this by calling GetConfigOption()
after the value has been reset by set_config_option(). It also skips
the report if the earlier value was the same as the default.

> On a related note, I suggest reverting or revising this logging change:
> http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=293c816e4aad8e760bcb4eaba0aa16da0ccd2d04

FWIW, I agree about this too.

I would suggest changing the errmsg to just "Parameter \"%s\" cannot be
changed without restarting the server". I have attached a second patch
to do this.

LOG: received SIGHUP, reloading configuration files
LOG: parameter "log_connections" reset to default value "off"
LOG: parameter "log_disconnections" reset to default value "off"
LOG: Parameter "max_connections" cannot be changed without restarting the server
LOG: parameter "log_checkpoints" changed to "on"

-- ams

Attachment Content-Type Size
log-parameter-changes.diff text/x-diff 1.7 KB
revise-293c81.diff text/x-diff 1.7 KB

From: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
To: Abhijit Menon-Sen <ams(at)toroid(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: Logging configuration changes [REVIEW]
Date: 2009-09-16 06:18:10
Message-ID: 3073cc9b0909152318t4cac4ebdu4582609175ed633@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Sep 16, 2009 at 12:24 AM, Abhijit Menon-Sen <ams(at)toroid(dot)org> wrote:
>
> LOG:  received SIGHUP, reloading configuration files
> LOG:  parameter "log_connections" reset to default value "off"
> LOG:  parameter "log_disconnections" reset to default value "off"
> LOG:  Parameter "max_connections" cannot be changed without restarting the server
> LOG:  parameter "log_checkpoints" changed to "on"
>

ok, maybe this is not the most brilliant observation but someone has
to say it... keep the same case in the word "parameter" ;)

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157


From: Abhijit Menon-Sen <ams(at)toroid(dot)org>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: Logging configuration changes [REVIEW]
Date: 2009-09-16 06:27:34
Message-ID: 20090916062734.GA18315@toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

At 2009-09-16 01:18:10 -0500, jcasanov(at)systemguards(dot)com(dot)ec wrote:
>
> ok, maybe this is not the most brilliant observation but someone has
> to say it... keep the same case in the word "parameter" ;)

Oops, thanks. Re²vised patch attached.

-- ams

Attachment Content-Type Size
revise-293c81.diff text/x-diff 1.7 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Abhijit Menon-Sen <ams(at)toroid(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Logging configuration changes [REVIEW]
Date: 2009-09-17 21:39:28
Message-ID: 1253223568.21712.16.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On ons, 2009-09-16 at 10:54 +0530, Abhijit Menon-Sen wrote:
> I can't help but think that it would be nice to report the default value
> of a parameter that is reset (i.e. "parameter $x reset to default value
> $y"). The first attached patch does this by calling GetConfigOption()
> after the value has been reset by set_config_option(). It also skips
> the report if the earlier value was the same as the default.

I have applied the rest, but the problem with this change is that it
logs the values without units. I'm not sure that we want to expose
that.