WL#6784: SHUTDOWN SQL Command
Status: Complete — Priority: Medium
We would like a SQL-level server shutdown command that supports normal, controlled shutdown which is similar to COM_SHUTDOWN. Without this command, utilities must execute mysqladmin as a sub process. Having a SHUTDOWN command permits users (utilities) to issue a controlled shutdown without resorting to external tools. Using a SHUTDOWN command as the last line in a --init-file, it will (hopefully) provide a method to execute a single sql file and shutdown server when done. This will be very useful in deployment phase in tools like puppet and Docker. Sample command: SHUTDOWN User Documentation ================== http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-9.html http://dev.mysql.com/doc/refman/5.7/en/shutdown.html
FR 1: A new SQL command SHUTDOWN will be added. Syntax of new command will be: SHUTDOWN Note: COM_SHUTDOWN supports options SHUTDOWN_WAIT_ALL_BUFFERS and SHUTDOWN_DEFAULT theoretically. Both shutdown option maps to SHUTDOWN_WAIT_ALL_BUFFER. COM_SHUTDOWN options are not actually used in server code. SQL command will simplify this and it will not take any options. In future based on requirement options can be added. FR 2: Functionality of SQL command SHUTDOWN will be same as COM_SHUTDOWN. FR 3: COM_SHUTDOWN will be deprecated and that mysqladmin will switch to the shutdown command. FR 4: SHUTDOWN SQL command should work from --init-file (eventually in both --bootstrap and normal startup modes).
IS 1: SQL command SHUTDOWN will be type COM_QUERY. Now user can add SQL SHUTDOWN command as part of sql file. After executing other SQL command, SHUTDOWN command will shutdown the server if added in sql file. IS 2: Inside COM_QUERY code handling if command is SHUTDOWN it will call the server shutdown code which will be same as COM_SHUTDOWN. (sql_parse.c) IS 3: mysqladmin will use SQL command SHUTDOWN for server version 5.7 and above. IS 4: mysqladmin will use COM_SHUTDOWN for server version lower then 5.7.
Copyright (c) 2000, 2018, Oracle Corporation and/or its affiliates. All rights reserved.