summaryrefslogtreecommitdiff
path: root/server-tools
diff options
context:
space:
mode:
authorunknown <rburnett@bk-internal.mysql.com>2006-08-17 17:19:41 +0200
committerunknown <rburnett@bk-internal.mysql.com>2006-08-17 17:19:41 +0200
commitb32b2ce7afa830257a1052f70b57eb3f3a38710f (patch)
treedbb8d11912bd8c6bbb4edc32d540effe9cce852b /server-tools
parent0073d9be28f42e7d6856e6c6e9496b4fa65d0868 (diff)
parent90b069ed34c293f7eb55f7827dd9fd086ff78015 (diff)
downloadmariadb-git-b32b2ce7afa830257a1052f70b57eb3f3a38710f.tar.gz
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
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: