pg_ctl default shutdown mode

Started by Peter Eisentrautalmost 25 years ago8 messages
#1Peter Eisentraut
peter_e@gmx.net

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/

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Peter Eisentraut (#1)
Re: pg_ctl default shutdown mode

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/

#3Hiroshi Inoue
Inoue@tpf.co.jp
In reply to: Peter Eisentraut (#2)
RE: Re: pg_ctl default shutdown mode

-----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

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Hiroshi Inoue (#3)
RE: Re: pg_ctl default shutdown mode

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/

#5Hiroshi Inoue
Inoue@tpf.co.jp
In reply to: Peter Eisentraut (#4)
RE: Re: pg_ctl default shutdown mode

-----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

#6Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Hiroshi Inoue (#5)
Re: Re: pg_ctl default shutdown mode

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, Pennsylvania 19026
#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hiroshi Inoue (#5)
Re: Re: pg_ctl default shutdown mode

"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

#8Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Tom Lane (#7)
Re: Re: pg_ctl default shutdown mode

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, Pennsylvania 19026