mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +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__
|
||||
|
Reference in New Issue
Block a user