Shutdown term

Started by Bruce Momjianalmost 25 years ago11 messages
#1Bruce Momjian
pgman@candle.pha.pa.us

Can somone improve the wording?

The system is shutting down.

when the backend receives a SIGTERM. Seems we need some wording that
can apply to db shutdown and individual backend termination by
administrators.

-- 
  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
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Bruce Momjian (#1)
Re: Shutdown term

Bruce Momjian writes:

Can somone improve the wording?

The system is shutting down.

when the backend receives a SIGTERM. Seems we need some wording that
can apply to db shutdown and individual backend termination by
administrators.

The connection was terminated.

And make the postmaster print out

The system is shutting down.

before it sends out the SIGTERM's.

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#2)
Re: Shutdown term

Peter Eisentraut <peter_e@gmx.net> writes:

The connection was terminated.
And make the postmaster print out
The system is shutting down.
before it sends out the SIGTERM's.

Unfortunately the postmaster is in no position to send any message to
the individual clients.

Maybe we should forget the idea of having a single message to cover
both cases, and instead provide some flag in shared memory that the
postmaster can set before it sends out SIGTERMs. Then the backends
would actually know why they got a SIGTERM and could emit
more-appropriate messages.

regards, tom lane

#4Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Tom Lane (#3)
Re: Shutdown term

Peter Eisentraut <peter_e@gmx.net> writes:

The connection was terminated.
And make the postmaster print out
The system is shutting down.
before it sends out the SIGTERM's.

Unfortunately the postmaster is in no position to send any message to
the individual clients.

Maybe we should forget the idea of having a single message to cover
both cases, and instead provide some flag in shared memory that the
postmaster can set before it sends out SIGTERMs. Then the backends
would actually know why they got a SIGTERM and could emit
more-appropriate messages.

Seems like overkill to me. We could have the postmaster use SIGQUIT for
db shutdown and leave SIGKILL for admin shutdown of individual backends.

-- 
  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
#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#4)
Re: Shutdown term

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Seems like overkill to me. We could have the postmaster use SIGQUIT for
db shutdown and leave SIGKILL for admin shutdown of individual backends.

Wrong... at least not with the current definitions of those signals!

regards, tom lane

#6Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Tom Lane (#5)
Re: Shutdown term

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Seems like overkill to me. We could have the postmaster use SIGQUIT for
db shutdown and leave SIGKILL for admin shutdown of individual backends.

Wrong... at least not with the current definitions of those signals!

I see you just changed them today:

pqsignal(SIGTERM, die); /* cancel current query and exit */
! pqsignal(SIGQUIT, quickdie); /* hard crash time */
! pqsignal(SIGALRM, HandleDeadLock); /* check for deadlock after timeout *

How about:

The database is shutting down.

and not mention server. The current 'system' has to be changed to
'database server' anyway.

-- 
  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
#7Zeugswetter Andreas SB
ZeugswetterA@wien.spardat.at
In reply to: Bruce Momjian (#6)
AW: Shutdown term

Peter Eisentraut <peter_e@gmx.net> writes:

The connection was terminated.

The connection has been terminated. ??

And make the postmaster print out
The system is shutting down.
before it sends out the SIGTERM's.

I like above. Imho it is sufficient if postmaster writes the "The system is shutting down."
to the log. Clients get the other message. That is how I interpreted Peter's message also.

Andreas

#8Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Zeugswetter Andreas SB (#7)
Re: AW: Shutdown term

[ Charset ISO-8859-1 unsupported, converting... ]

Peter Eisentraut <peter_e@gmx.net> writes:

The connection was terminated.

The connection has been terminated. ??

And make the postmaster print out
The system is shutting down.
before it sends out the SIGTERM's.

I like above. Imho it is sufficient if postmaster writes the "The system is shutting down."
to the log. Clients get the other message. That is how I interpreted Peter's message also.

OK, I phoned Tom and we agreed on this wording:

This connection has been terminated by the administrator

Comments?

-- 
  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
#9Thomas Swan
tswan-lst@ics.olemiss.edu
In reply to: Bruce Momjian (#8)
Re: AW: Shutdown term

OK, I phoned Tom and we agreed on this wording:

This connection has been terminated by the administrator

Comments?

This connection has been terminated by an administrator
(there may be more than one...) :)

Other than that it's informative enough.

OTOH, I had a small thought on this.

If you had a messaging scheme to print to clients when a signal was
received, is there the possibility of more informative messages perhaps
that could be sent by the pg_ctl program through the postmaster (or
backends) on shutdowns? This would allow for some decent scripting. For
example, the database is shutdown without the system going down or the
whole system is going down for maintenance or scheduled reboot.

It may seem stupid but I was thinking the reason could be an argument to
the pg_ctl program with a default of (Database Shutdown).

pg_ctl stop --message="System going down for a reboot"
or
pg_ctl stop -msg "System upgrade. System will be available again at 5:00am"

The client would receive
The connection has been terminated
[System Shutdown|Database Shutdown|Unknown Reason|"some string as an argument"]

Also, it allows for more informative messages.
Scheduled downtime (System will be online again at {whenever})
Idle Timeout
You are using too much CPU...
You are using too little CPU...

These message can be set by the scripts for "run level" changes and the like.

#10Peter Eisentraut
peter_e@gmx.net
In reply to: Thomas Swan (#9)
Re: AW: Shutdown term

Thomas Swan writes:

It may seem stupid but I was thinking the reason could be an argument to
the pg_ctl program with a default of (Database Shutdown).

pg_ctl stop --message="System going down for a reboot"
or
pg_ctl stop -msg "System upgrade. System will be available again at 5:00am"

I foresee a PQmotd(PGconn *) function ... ;-)

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

#11Thomas Swan
tswan@ics.olemiss.edu
In reply to: Peter Eisentraut (#10)
Re: AW: Shutdown term

At 3/14/2001 11:13 AM, Peter Eisentraut wrote:

Thomas Swan writes:

It may seem stupid but I was thinking the reason could be an argument to
the pg_ctl program with a default of (Database Shutdown).

pg_ctl stop --message="System going down for a reboot"
or
pg_ctl stop -msg "System upgrade. System will be available again at 5:00am"

I foresee a PQmotd(PGconn *) function ... ;-)

Well, I also thought you could use the same method to do a warning.

pg_ctl --message="Database going offline in 5 minutes"

or something along those lines...