Bug #2651 There is no documentation on how shutdown behaves within the server
Submitted: 5 Feb 2004 8:23 Modified: 28 Jul 2004 22:11
Reporter: Tim Bunce Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:
Assigned to: Paul DuBois CPU Architecture:Any

[5 Feb 2004 8:23] Tim Bunce
Description:
I can't find any documentation of the steps taken by mysqld
when it initiates a shutdown.

How to repeat:
Search the documentation

Suggested fix:
Document the shutdown logic.

When are threads killed?
When are tables flushed?
When are new connections prevented?

What happens if a thread doesn't respond to being marked killed?
What emergency procedure should be followed if the server process doesn't exit?
(in order to minimize tables being left marked open)
[5 Feb 2004 13:47] Paul DuBois
Guess what? Docs doesn't know the answer to this,
either!

Someone please make a suggestion as to who knows
how this works, and who can discuss it with me to
get it documented properly.
[22 Feb 2004 23:43] Peter Zaitsev
I wrote description of Shutdown procedure to Paul and we'll work to make it included in the manual.
[26 May 2004 23:41] Tim Bunce
Any progress on this?
[15 Jun 2004 16:23] Tim Bunce
Any news on this?

I see development work is being done on to add different levels of shutdown, but without documenting how it currently works it's hard to be able to contribute to or comment usefully on that work.

Please raise the priority of this.
[15 Jun 2004 17:46] Paul DuBois
I'm still trying to get developer feedback to questions that
I have raised.
[15 Jun 2004 19:09] Guilhem Bichot
Here is already some basic info:
when you do 'mysqladmin shutdown' or send a SIGTERM to mysqld (like 'service mysql stop'):
- new connections are forbidden (by closing the socket; thus the new connections may look hanged).
- idle existing connections are killed.
- active existing connections are killed in the middle of what they were doing (which is a problem for MyISAM updates); in 4.0 some statements refuse to be killed (like CHECK TABLE) but this is fixed in 4.1.
- when there are no more existing connections, storage engines are "closed", that is the InnoDB buffer pool is flushed, the MyISAM indexes are flushed if using delay-key-write
- shutdown is finished.
[28 Jul 2004 22:11] Paul DuBois
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).

Additional info:

See: http://dev.mysql.com/doc/mysql/en/Server_Shutdown.html