Thread: pg_ctl default shutdown mode

pg_ctl default shutdown mode

From
Peter Eisentraut
Date:
Now that waiting for shutdown is the default, it seems that the default
shutdown mode should also be one where there's a high chance of the
shutdown actually happening.  As it stands, if there are connected
clients, pg_ctl will wait for 60 or so seconds before proclaiming that the
postmaster won't shut down.  This is not intuitive.

The signal is still delivered, though, so the postmaster may silently shut
down at any later time.  This can cause confusion.

While the "smart" shutdown is a cute feature, a *stop* script should
really stop the thing by default and allow the unusual behaviour to be
selected with an option.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



Re: pg_ctl default shutdown mode

From
Peter Eisentraut
Date:
Since there were no comments, I'm going to make fast shutdown the default.

I wrote:

> Now that waiting for shutdown is the default, it seems that the default
> shutdown mode should also be one where there's a high chance of the
> shutdown actually happening.  As it stands, if there are connected
> clients, pg_ctl will wait for 60 or so seconds before proclaiming that the
> postmaster won't shut down.  This is not intuitive.
>
> The signal is still delivered, though, so the postmaster may silently shut
> down at any later time.  This can cause confusion.
>
> While the "smart" shutdown is a cute feature, a *stop* script should
> really stop the thing by default and allow the unusual behaviour to be
> selected with an option.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



RE: Re: pg_ctl default shutdown mode

From
"Hiroshi Inoue"
Date:
> -----Original Message-----
> From: Peter Eisentraut
>
> Since there were no comments, I'm going to make fast shutdown the default.
>

Oh I've misunderstood.
I object to the change.

Regards,
Hiroshi Inoue



RE: Re: pg_ctl default shutdown mode

From
Peter Eisentraut
Date:
Hiroshi Inoue writes:

> > Since there were no comments, I'm going to make fast shutdown the default.
> >
>
> Oh I've misunderstood.
> I object to the change.

Do you feel the current behaviour is more intuitive?  Just curious.  I
just think that waiting by default and smart shutdown don't really mix
well.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



RE: Re: pg_ctl default shutdown mode

From
"Hiroshi Inoue"
Date:
> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net]
> 
> Hiroshi Inoue writes:
> 
> > > Since there were no comments, I'm going to make fast shutdown 
> the default.
> > >
> >
> > Oh I've misunderstood.
> > I object to the change.
> 
> Do you feel the current behaviour is more intuitive?

Yes.

> Just curious.  I
> just think that waiting by default and smart shutdown don't really mix
> well.
> 

Current behavior prevents manual shutdown from cancelling
running sessions carelessly. 
OTOH it's the dba's responsibilty to write appropriate shutdown
scripts and it's not good to rely on default in writing them in the
first place.

Regards,
Hiroshi Inoue


Re: Re: pg_ctl default shutdown mode

From
Bruce Momjian
Date:
> > Just curious.  I
> > just think that waiting by default and smart shutdown don't really mix
> > well.
> > 
> 
> Current behavior prevents manual shutdown from cancelling
> running sessions carelessly. 
> OTOH it's the dba's responsibilty to write appropriate shutdown
> scripts and it's not good to rely on default in writing them in the
> first place.

Yes, but too many people do stupid things.  If they are smart enough to
write a script, they are smart enough to use a flag to make it do what
they want it to do.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: Re: pg_ctl default shutdown mode

From
Tom Lane
Date:
"Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
>> From: Peter Eisentraut [mailto:peter_e@gmx.net]
>> Just curious.  I
>> just think that waiting by default and smart shutdown don't really mix
>> well.

> Current behavior prevents manual shutdown from cancelling
> running sessions carelessly. 

Seems that pg_ctl is being made to serve two different purposes:
one, manual shutdown, and two, automated shutdown during system-wide
shutdown.  In the second case, 'fast' shutdown is the appropriate thing,
but in the first case I think 'smart' shutdown is definitely the safer
and more appropriate default.

So, how to resolve that conflict?  I think it's better for the script
default to cater to the manual-invocation case, because you're more
likely to forget to add the switch when you're entering the command by
hand.  When pg_ctl is invoked from a system shutdown script, you only
have to get it right once, and then the script remembers for you ;-).

In short: I agree with Hiroshi on this one.  Let's leave the script
default at 'smart' shutdown, and make it clear in the documentation
that "-mode fast" is the best way to invoke it from a system-shutdown
script.
        regards, tom lane


Re: Re: pg_ctl default shutdown mode

From
Bruce Momjian
Date:
> So, how to resolve that conflict?  I think it's better for the script
> default to cater to the manual-invocation case, because you're more
> likely to forget to add the switch when you're entering the command by
> hand.  When pg_ctl is invoked from a system shutdown script, you only
> have to get it right once, and then the script remembers for you ;-).
> 
> In short: I agree with Hiroshi on this one.  Let's leave the script
> default at 'smart' shutdown, and make it clear in the documentation
> that "-mode fast" is the best way to invoke it from a system-shutdown
> script.

Agreed.  Default to the best mode for manual usage.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026