1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

API change: mysql_shutdown() now needs a 2nd parameter, the shutdown level.

Server will however still accept shutdown without specified level; so that old
mysqladmin can still shut server down.
I would like your comments on the names of shutdown level which I chose. You
are welcome to propose better names. Please however check WL#709 before.
Reason for the names I propose is to be accurate, thus leaving possibility
for other levels which we may imagine in the future; that's why I have rejected
names like "fast", "smart", "graceful" so far. My position is that WAIT_ALL_BUFFERS
or WAIT_CRITICAL_BUFFERS say what the shutdown does, whereas for "smart", "fast" you
need to remember what it does.
This should be pushed in 4.1.3 but only after your comments.
This commit is contained in:
guilhem@mysql.com
2004-06-15 11:35:23 +02:00
parent 5dd2881f54
commit f1fda6387e
6 changed files with 49 additions and 6 deletions

View File

@@ -1308,6 +1308,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (command != COM_STATISTICS && command != COM_PING)
query_id++;
thread_running++;
/* TODO: set thd->lex->sql_command to SQLCOM_PARSE here */
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->server_status&=
@@ -1478,6 +1479,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->query_length= length;
thd->query= packet;
thd->query_id= query_id++;
/* TODO: set thd->lex->sql_command to SQLCOM_PARSE here */
VOID(pthread_mutex_unlock(&LOCK_thread_count));
#ifndef EMBEDDED_LIBRARY
mysql_parse(thd, packet, length);
@@ -1631,10 +1633,25 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
#ifndef EMBEDDED_LIBRARY
case COM_SHUTDOWN:
{
statistic_increment(com_other,&LOCK_status);
if (check_global_access(thd,SHUTDOWN_ACL))
break; /* purecov: inspected */
DBUG_PRINT("quit",("Got shutdown command"));
enum enum_shutdown_level level= (packet_length >= 2) ?
(enum enum_shutdown_level) (uchar) packet[0] : SHUTDOWN_DEFAULT;
DBUG_PRINT("quit",("Got shutdown command for level %u", level));
/*
Accept old mysql_shutdown (with no argument). For now we do nothing of
the argument.
*/
if (level == SHUTDOWN_DEFAULT)
level= SHUTDOWN_WAIT_ALL_BUFFERS; // soon default will be configurable
else if (level != SHUTDOWN_WAIT_ALL_BUFFERS)
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "this shutdown level");
send_error(thd);
break;
}
mysql_log.write(thd,command,NullS);
send_eof(thd);
#ifdef __WIN__
@@ -1650,6 +1667,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
kill_mysql();
error=TRUE;
break;
}
#endif
case COM_STATISTICS:
{