Comment 8 for bug 620441

Revision history for this message
Clint Byrum (clint-fewbar) wrote : Re: [Bug 620441] Re: MySQL upstart stop job does not cleanly shutdown mysql

On Aug 24, 2010, at 9:50 AM, Scott James Remnant wrote:

> On Tue, 2010-08-24 at 16:23 +0000, Clint Byrum wrote:
>
>> Can we abort the stop from pre-stop somehow? Otherwise I'm afraid users
>> will either be left waiting forever, or still sending SIGKILL.
>>
> You can call "start" from the pre-stop script, which will return the job
> to a running state.
>

This sounds like a solution then... in pseudo code

while true
  send shutdown to mysql
  wait 5 seconds
  if mysql still running
    if runlevel not in (0,1,6)
      # manual stop, not reboot/halt
      if 30 seconds has passed
        report to user that mysql will probably die and restart
        start again # will respawn mysqld when it does die
    else
      log warning about waiting forever to reboot/halt..
  else
    break # service is dead

> That being said, Upstart will happily wait forever for pre-stop before
> sending SIGKILL - so if the database takes a long time to stop, that's
> ok

It would be ok, but I'm not sure I like it.

Would there be an indication anywhere for users that they're waiting on mysql to die?