List:Commits« Previous MessageNext Message »
From:msvensson Date:September 25 2006 7:34am
Subject:bk commit into 5.1 tree (msvensson:1.2318)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson 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-09-25 09:34:34+02:00, msvensson@neptunus.(none) +3 -0
  Merge neptunus.(none):/home/msvensson/mysql/bug22379_runtime/my50-bug22379_runtime
  into  neptunus.(none):/home/msvensson/mysql/bug22379_runtime/my51-bug22379_runtime
  MERGE: 1.1810.1968.28

  server-tools/instance-manager/guardian.cc@stripped, 2006-09-25 09:34:30+02:00, msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.20.1.3

  server-tools/instance-manager/instance.cc@stripped, 2006-09-25 09:34:30+02:00, msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.32.2.1

  server-tools/instance-manager/instance_options.cc@stripped, 2006-09-25 09:34:31+02:00, msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.29.1.3

# 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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug22379_runtime/my51-bug22379_runtime/RESYNC

--- 1.24/server-tools/instance-manager/guardian.cc	2006-09-25 09:34:40 +02:00
+++ 1.25/server-tools/instance-manager/guardian.cc	2006-09-25 09:34:40 +02:00
@@ -146,20 +146,35 @@
 
   if (instance->is_running())
   {
-    /* clear status fields */
-    current_node->restart_counter= 0;
-    current_node->crash_moment= 0;
-    current_node->state= STARTED;
+    /* The instance can be contacted  on it's port */
+
+    /* If STARTING also check that pidfile has been created */
+    if (current_node->state == STARTING &&
+        current_node->instance->options.get_pid() == 0)
+    {
+      /* Pid file not created yet, don't go to STARTED state yet  */
+    }
+    else
+    {
+      /* clear status fields */
+      log_info("guardian: instance %s is running, set state to STARTED",
+               instance->options.instance_name);
+      current_node->restart_counter= 0;
+      current_node->crash_moment= 0;
+      current_node->state= STARTED;
+    }
   }
   else
   {
     switch (current_node->state) {
     case NOT_STARTED:
-      instance->start();
-      current_node->last_checked= current_time;
       log_info("guardian: starting instance %s",
                instance->options.instance_name);
+
+      /* NOTE, set state to STARTING _before_ start() is called */
       current_node->state= STARTING;
+      instance->start();
+      current_node->last_checked= current_time;
       break;
     case STARTED:     /* fallthrough */
     case STARTING:    /* let the instance start or crash */

--- 1.36/server-tools/instance-manager/instance.cc	2006-09-25 09:34:40 +02:00
+++ 1.37/server-tools/instance-manager/instance.cc	2006-09-25 09:34:40 +02:00
@@ -611,18 +611,19 @@
   /* if there are no pid, everything seems to be fine */
   if ((pid= options.get_pid()) != 0)            /* get pid from pidfile */
   {
-    /*
-      If we cannot kill mysqld, then it has propably crashed.
-      Let us try to remove staled pidfile and return successfully
-      as mysqld is probably stopped.
-    */
-    if (!kill(pid, signum))
-      options.unlink_pidfile();
-    else if (signum == SIGKILL)      /* really killed instance with SIGKILL */
-      log_error("The instance %s is being stopped forsibly. Normally \
-                it should not happed. Probably the instance has been \
-                hanging. You should also check your IM setup",
-                options.instance_name);
+    if (kill(pid, signum) == 0)
+    {
+      /* Kill suceeded */
+      if (signum == SIGKILL)      /* really killed instance with SIGKILL */
+      {
+        log_error("The instance %s is being stopped forcibly. Normally" \
+                  "it should not happen. Probably the instance has been" \
+                  "hanging. You should also check your IM setup",
+                  options.instance_name);
+        /* After sucessful hard kill the pidfile need to be removed */
+        options.unlink_pidfile();
+      }
+    }
   }
   return;
 }

--- 1.36/server-tools/instance-manager/instance_options.cc	2006-09-25 09:34:40 +02:00
+++ 1.37/server-tools/instance-manager/instance_options.cc	2006-09-25 09:34:40 +02:00
@@ -406,7 +406,8 @@
   {
     pid_t pid;
 
-    fscanf(pid_file_stream, "%i", &pid);
+    if (fscanf(pid_file_stream, "%i", &pid) != 1)
+      pid= -1;
     my_fclose(pid_file_stream, MYF(0));
     return pid;
   }
Thread
bk commit into 5.1 tree (msvensson:1.2318)msvensson25 Sep