MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:July 12 2006 7:30pm
Subject:bk commit into 5.0 tree (jimw:1.2232) BUG#12673
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-07-12 12:30:22-07:00, jimw@rama.(none) +4 -0
  Bug #12673: Instance Manager: allows to stop the instance many times
  
    The instance manager was not actually checking whether an instance
    was actually running before trying to stop it. Now it checks first.

  mysql-test/r/im_life_cycle.result@stripped, 2006-07-12 12:30:19-07:00, jimw@rama.(none) +3 -0
    Add new results

  mysql-test/t/im_life_cycle.imtest@stripped, 2006-07-12 12:30:19-07:00, jimw@rama.(none) +8 -0
    Add new regression test

  server-tools/instance-manager/instance.cc@stripped, 2006-07-12 12:30:20-07:00, jimw@rama.(none) +23 -22
    Fix Instance::stop() to report ER_INSTANCE_IS_NOT_STARTED when that is
    the case. Also removed unnecessary goto.

  server-tools/instance-manager/messages.cc@stripped, 2006-07-12 12:30:20-07:00, jimw@rama.(none) +3 -3
    Fix messages with missing spaces

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-12673

--- 1.6/mysql-test/r/im_life_cycle.result	2006-07-12 12:30:26 -07:00
+++ 1.7/mysql-test/r/im_life_cycle.result	2006-07-12 12:30:26 -07:00
@@ -74,3 +74,6 @@
 ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
 STOP INSTANCE mysqld1,mysqld2,mysqld3;
 ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
+STOP INSTANCE mysqld2;
+ERROR HY000: Cannot stop instance. Perhaps the instance is not started, or was started manually, so IM cannot find the pidfile.
+End of 5.0 tests

--- 1.5/mysql-test/t/im_life_cycle.imtest	2006-07-12 12:30:26 -07:00
+++ 1.6/mysql-test/t/im_life_cycle.imtest	2006-07-12 12:30:26 -07:00
@@ -218,3 +218,11 @@
 
 --error ER_SYNTAX_ERROR
 STOP INSTANCE mysqld1,mysqld2,mysqld3;
+
+#
+# Bug #12673: Instance Manager: allows to stop the instance many times
+#
+--error 3001
+STOP INSTANCE mysqld2;
+
+--echo End of 5.0 tests

--- 1.32/server-tools/instance-manager/instance.cc	2006-07-12 12:30:26 -07:00
+++ 1.33/server-tools/instance-manager/instance.cc	2006-07-12 12:30:26 -07:00
@@ -469,37 +469,38 @@
   struct timespec timeout;
   uint waitchild= (uint)  DEFAULT_SHUTDOWN_DELAY;
 
-  if (options.shutdown_delay_val)
-    waitchild= options.shutdown_delay_val;
+  if (is_running())
+  {
+    if (options.shutdown_delay_val)
+      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__

--- 1.5/server-tools/instance-manager/messages.cc	2006-07-12 12:30:26 -07:00
+++ 1.6/server-tools/instance-manager/messages.cc	2006-07-12 12:30:26 -07:00
@@ -48,8 +48,8 @@
   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:
@@ -67,7 +67,7 @@
     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";
   default:
Thread
bk commit into 5.0 tree (jimw:1.2232) BUG#12673Jim Winstead12 Jul