Thread: pg_ctl reload -o "...."

pg_ctl reload -o "...."

From
Jeff Janes
Date:
If I want to change a parameter that affects an auxiliary process
(like bgwriter), I can usually get away with doing;

pg_ctl restart -o '--setting=new'

But sometimes I really need to avoid the restart, because it blows
away shared_buffers or for other reasons.

I can do pg_ctl reload, but that ignores the -o option (without
notice).  So to go the reload route, I have to edit "postgresql.conf"
before doing the reload.  This is quite tedious and error-prone,
especially in a script.

Is there a reason pg_ctl reload shouldn't honor -o ?  Is there
reasonable avenue to get it do so?

Cheers,

Jeff



Re: pg_ctl reload -o "...."

From
Tom Lane
Date:
Jeff Janes <jeff.janes@gmail.com> writes:
> Is there a reason pg_ctl reload shouldn't honor -o ?

-o means "pass these switches on the postmaster's command line".
If you're not restarting the postmaster, you don't get to change
its command line.

IMO setting stuff on the command line is pretty evil anyway.
Adjusting postgresql.conf is almost always the Better Way.
We have discussions going already about how to make that easier,
so I'm not excited about trying to kluge something in pg_ctl.
        regards, tom lane



Re: pg_ctl reload -o "...."

From
Jeff Janes
Date:
On Thu, Nov 15, 2012 at 11:26 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Jeff Janes <jeff.janes@gmail.com> writes:
>> Is there a reason pg_ctl reload shouldn't honor -o ?
>
> -o means "pass these switches on the postmaster's command line".
> If you're not restarting the postmaster, you don't get to change
> its command line.

OK.  You see pg_ctl as a wrapper around postmaster, while I was
viewing it as a thing in itself.

> IMO setting stuff on the command line is pretty evil anyway.

I wouldn't do it in a production system, but it is invaluable for
performance testing during development or diagnosis.

Oh well, I guess this is what perl -i -pe is for.

Cheers,

Jeff



Re: pg_ctl reload -o "...."

From
Andrew Dunstan
Date:
On 11/15/2012 03:41 PM, Jeff Janes wrote:
> On Thu, Nov 15, 2012 at 11:26 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Jeff Janes <jeff.janes@gmail.com> writes:
>>> Is there a reason pg_ctl reload shouldn't honor -o ?
>> -o means "pass these switches on the postmaster's command line".
>> If you're not restarting the postmaster, you don't get to change
>> its command line.
> OK.  You see pg_ctl as a wrapper around postmaster, while I was
> viewing it as a thing in itself.


You're possibly not aware of its history. Before 8.0 it was a shell 
script and its use was seen as rather optional. IIRC there was even some 
debate about whether or not we needed it at all for the original Windows 
port (luckily Bruce and I thought we did, and made it happen.)


cheers

andrew



Re: pg_ctl reload -o "...."

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> On 11/15/2012 03:41 PM, Jeff Janes wrote:
>> OK.  You see pg_ctl as a wrapper around postmaster, while I was
>> viewing it as a thing in itself.

> You're possibly not aware of its history. Before 8.0 it was a shell 
> script and its use was seen as rather optional.

It's *still* rather optional.  A lot of distros use init scripts that
don't bother with it.  Personally I find it convenient for stopping
the postmaster, but not all that helpful for starting it.
        regards, tom lane