mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge bk-internal.mysql.com:/data0/bk/tmp_reg
into bk-internal.mysql.com:/data0/bk/mysql-5.1 client/mysql.cc: Auto merged mysql-test/r/ctype_utf8.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/im_life_cycle.result: Auto merged mysql-test/r/information_schema_db.result: Auto merged mysql-test/r/type_newdecimal.result: Auto merged mysql-test/r/type_ranges.result: Auto merged mysql-test/r/type_timestamp.result: Auto merged mysql-test/t/ctype_utf8.test: Auto merged mysql-test/t/gis.test: Auto merged mysql-test/t/im_life_cycle.imtest: Auto merged mysql-test/t/type_newdecimal.test: Auto merged mysql-test/t/type_timestamp.test: Auto merged server-tools/instance-manager/messages.cc: Auto merged sql/item_geofunc.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_view.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged sql/share/errmsg.txt: Auto merged tests/mysql_client_test.c: Auto merged
This commit is contained in:
@ -501,44 +501,46 @@ int Instance::stop()
|
||||
struct timespec timeout;
|
||||
uint waitchild= (uint) DEFAULT_SHUTDOWN_DELAY;
|
||||
|
||||
if (options.shutdown_delay)
|
||||
if (is_running())
|
||||
{
|
||||
/*
|
||||
NOTE: it is important to check shutdown_delay here, but use
|
||||
shutdown_delay_val. The idea is that if the option is unset,
|
||||
shutdown_delay will be NULL, but shutdown_delay_val will not be reset.
|
||||
*/
|
||||
waitchild= options.shutdown_delay_val;
|
||||
if (options.shutdown_delay)
|
||||
{
|
||||
/*
|
||||
NOTE: it is important to check shutdown_delay here, but use
|
||||
shutdown_delay_val. The idea is that if the option is unset,
|
||||
shutdown_delay will be NULL, but shutdown_delay_val will not be reset.
|
||||
*/
|
||||
waitchild= options.shutdown_delay_val;
|
||||
}
|
||||
}
|
||||
|
||||
kill_instance(SIGTERM);
|
||||
/* sleep on condition to wait for SIGCHLD */
|
||||
kill_instance(SIGTERM);
|
||||
/* sleep on condition to wait for SIGCHLD */
|
||||
|
||||
timeout.tv_sec= time(NULL) + waitchild;
|
||||
timeout.tv_nsec= 0;
|
||||
if (pthread_mutex_lock(&LOCK_instance))
|
||||
goto err;
|
||||
timeout.tv_sec= time(NULL) + waitchild;
|
||||
timeout.tv_nsec= 0;
|
||||
if (pthread_mutex_lock(&LOCK_instance))
|
||||
return ER_STOP_INSTANCE;
|
||||
|
||||
while (options.get_pid() != 0) /* while server isn't stopped */
|
||||
{
|
||||
int status;
|
||||
while (options.get_pid() != 0) /* while server isn't stopped */
|
||||
{
|
||||
int status;
|
||||
|
||||
status= pthread_cond_timedwait(&COND_instance_stopped,
|
||||
&LOCK_instance,
|
||||
&timeout);
|
||||
if (status == ETIMEDOUT || status == ETIME)
|
||||
break;
|
||||
status= pthread_cond_timedwait(&COND_instance_stopped,
|
||||
&LOCK_instance,
|
||||
&timeout);
|
||||
if (status == ETIMEDOUT || status == ETIME)
|
||||
break;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&LOCK_instance);
|
||||
|
||||
kill_instance(SIGKILL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&LOCK_instance);
|
||||
|
||||
kill_instance(SIGKILL);
|
||||
|
||||
return 0;
|
||||
|
||||
return ER_INSTANCE_IS_NOT_STARTED;
|
||||
err:
|
||||
return ER_STOP_INSTANCE;
|
||||
}
|
||||
|
||||
#ifdef __WIN__
|
||||
|
@ -47,8 +47,8 @@ static const char *mysqld_error_message(unsigned sql_errno)
|
||||
case ER_BAD_INSTANCE_NAME:
|
||||
return "Bad instance name. Check that the instance with such a name exists";
|
||||
case ER_INSTANCE_IS_NOT_STARTED:
|
||||
return "Cannot stop instance. Perhaps the instance is not started, or was started"
|
||||
"manually, so IM cannot find the pidfile.";
|
||||
return "Cannot stop instance. Perhaps the instance is not started, or was"
|
||||
" started manually, so IM cannot find the pidfile.";
|
||||
case ER_INSTANCE_ALREADY_STARTED:
|
||||
return "The instance is already started";
|
||||
case ER_CANNOT_START_INSTANCE:
|
||||
@ -66,7 +66,7 @@ static const char *mysqld_error_message(unsigned sql_errno)
|
||||
return "Cannot open log file";
|
||||
case ER_GUESS_LOGFILE:
|
||||
return "Cannot guess the log filename. Try specifying full log name"
|
||||
"in the instance options";
|
||||
" in the instance options";
|
||||
case ER_ACCESS_OPTION_FILE:
|
||||
return "Cannot open the option file to edit. Check permissions";
|
||||
case ER_DROP_ACTIVE_INSTANCE:
|
||||
|
Reference in New Issue
Block a user