summaryrefslogtreecommitdiff
path: root/server-tools
diff options
context:
space:
mode:
authorrburnett@bk-internal.mysql.com <>2006-08-17 17:19:41 +0200
committerrburnett@bk-internal.mysql.com <>2006-08-17 17:19:41 +0200
commitd65095b45167c449d87f27ccd2dba13593524547 (patch)
treedbb8d11912bd8c6bbb4edc32d540effe9cce852b /server-tools
parentdd1d46c2cdd19b0113b81f7187d94c68a184f6e2 (diff)
parent38a36da86d3a4cb910d328386b29c38c79104706 (diff)
downloadmariadb-git-d65095b45167c449d87f27ccd2dba13593524547.tar.gz
Merge bk-internal.mysql.com:/data0/bk/tmp_reg
into bk-internal.mysql.com:/data0/bk/mysql-5.1
Diffstat (limited to 'server-tools')
-rw-r--r--server-tools/instance-manager/instance.cc56
-rw-r--r--server-tools/instance-manager/messages.cc6
2 files changed, 32 insertions, 30 deletions
diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc
index 340a2d67353..33a31cfd97e 100644
--- a/server-tools/instance-manager/instance.cc
+++ b/server-tools/instance-manager/instance.cc
@@ -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);
+ pthread_mutex_unlock(&LOCK_instance);
- kill_instance(SIGKILL);
+ kill_instance(SIGKILL);
- return 0;
+ return 0;
+ }
return ER_INSTANCE_IS_NOT_STARTED;
-err:
- return ER_STOP_INSTANCE;
}
#ifdef __WIN__
diff --git a/server-tools/instance-manager/messages.cc b/server-tools/instance-manager/messages.cc
index af35af1e7b0..7b32b66fe52 100644
--- a/server-tools/instance-manager/messages.cc
+++ b/server-tools/instance-manager/messages.cc
@@ -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: