On Tue, Oct 27, 2009 at 7:51 AM, Bryan Cantwell <bcantw...@firescope.com> wrote: > I notice that issuing a reboot or shutdown -r now command, (in Linux) that > the 'service mysql stop' is never run... it just seems to catch the sig 15 > and does its own shutdown... > I have scripted in the stop section of my init script to touch a file that I > look for on restart, but if the stop is never executed on reboot/shutdown, > then I have a problem.
What distro? Which version of mysql? My comments below apply to our InnoDB heavy CentOS systems. Older versions of mysql (5.0.x on our CentOS machines) wait 60 seconds for the mysqld process to completely die. If mysql has a lot of data to flush to disk, it can take longer than that 60 seconds. The init script assumes that the kill command didn't succeed, it prints out FAILED, and the system shutdown process moves on to the next init script. Near the end of the system shutdown process, the shutdown script issues a final SIGKILL to remaining running processes. If mysqld didn't finish flushing that data before this final KILL signal, the mysqld process is killed instantly and you have an unclean shutdown. One quick solution is to manually stop mysql, watching to see when the process finally goes away (top, ps, etc), then do your shutdown -r now. Modern versions of mysql (5.1.x) seem to handle this better because it waits as long as it takes for mysqld to shut down properly or to start up (and accept connections). At least in my testing so far, I've not hit a timeout or received an incorrect OK or FAILED message in the 5.1.x series. -- Regards... Todd The best thing about pair programming is that you have the perfect audience for your genius. -- Kent Beck -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org