List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:July 26 2007 5:08pm
Subject:bk commit into 5.1 tree (anozdrin:1.2561) BUG#28030
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of alik. When alik 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, 2007-07-26 21:08:00+04:00, anozdrin@ibm. +4 -0
  Fix for BUG#28030: test im_instance_conf fails with an assert.
  
  The problem was a race condition on shutdown -- when IM got shutdown
  request while a guarded mysqld is starting. In this case the Guardian
  thread tried to stop the mysqld, but might fail if the mysqld hadn't
  created pid-file so far. When this happened, the mysqld-monitor thread
  didn't stop, so the assert in Thread_registry happened.
  
  The fix is to make several attempts to stop mysqld if it is active.

  server-tools/instance-manager/guardian.cc@stripped, 2007-07-26 21:07:57+04:00, anozdrin@ibm. +12 -1
    Try to stop mysqld several times if it is still active.

  server-tools/instance-manager/instance.cc@stripped, 2007-07-26 21:07:57+04:00, anozdrin@ibm. +5 -3
    Make Instance::kill_mysqld() to return operation status.

  server-tools/instance-manager/instance.h@stripped, 2007-07-26 21:07:57+04:00, anozdrin@ibm. +1 -1
    Make Instance::kill_mysqld() to return operation status.

  server-tools/instance-manager/thread_registry.cc@stripped, 2007-07-26 21:07:57+04:00, anozdrin@ibm. +6 -2
    Log unregistered thread ids.

diff -Nrup a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc
--- a/server-tools/instance-manager/guardian.cc	2007-02-23 14:13:48 +03:00
+++ b/server-tools/instance-manager/guardian.cc	2007-07-26 21:07:57 +04:00
@@ -438,7 +438,18 @@ void Guardian::stop_instances()
 
     /* Request mysqld to stop. */
 
-    instance->kill_mysqld(SIGTERM);
+    while (true)
+    {
+      if (!instance->kill_mysqld(SIGTERM))
+        break;
+
+      if (!instance->is_active())
+        break;
+
+      /* Sleep for 0.3 sec and check again. */
+
+      my_sleep(300000);
+    }
 
     instance->unlock();
   }
diff -Nrup a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc
--- a/server-tools/instance-manager/instance.cc	2007-07-23 17:05:48 +04:00
+++ b/server-tools/instance-manager/instance.cc	2007-07-26 21:07:57 +04:00
@@ -771,7 +771,7 @@ bool Instance::stop_mysqld()
     These operations should also be used in Guardian to manage instances.
 */
 
-void Instance::kill_mysqld(int signum)
+bool Instance::kill_mysqld(int signum)
 {
   pid_t mysqld_pid= options.load_pid();
 
@@ -780,7 +780,7 @@ void Instance::kill_mysqld(int signum)
     log_info("Instance '%s': no pid file to send a signal (%d).",
              (const char *) get_name()->str,
              (int) signum);
-    return;
+    return TRUE;
   }
 
   log_info("Instance '%s': sending %d to %d...",
@@ -792,7 +792,7 @@ void Instance::kill_mysqld(int signum)
   {
     log_info("Instance '%s': kill() failed.",
              (const char *) get_name()->str);
-    return;
+    return TRUE;
   }
 
   /* Kill suceeded */
@@ -804,6 +804,8 @@ void Instance::kill_mysqld(int signum)
     /* After sucessful hard kill the pidfile need to be removed */
     options.unlink_pidfile();
   }
+
+  return FALSE;
 }
 
 
diff -Nrup a/server-tools/instance-manager/instance.h b/server-tools/instance-manager/instance.h
--- a/server-tools/instance-manager/instance.h	2007-01-03 00:18:05 +03:00
+++ b/server-tools/instance-manager/instance.h	2007-07-26 21:07:57 +04:00
@@ -104,7 +104,7 @@ public:
 
   bool start_mysqld();
   bool stop_mysqld();
-  void kill_mysqld(int signo);
+  bool kill_mysqld(int signo);
 
   void lock();
   void unlock();
diff -Nrup a/server-tools/instance-manager/thread_registry.cc b/server-tools/instance-manager/thread_registry.cc
--- a/server-tools/instance-manager/thread_registry.cc	2007-07-25 13:31:44 +04:00
+++ b/server-tools/instance-manager/thread_registry.cc	2007-07-26 21:07:57 +04:00
@@ -64,8 +64,12 @@ Thread_registry::~Thread_registry()
   /* Check that no one uses the repository. */
   pthread_mutex_lock(&LOCK_thread_registry);
 
-  if (head.next != &head)
-    log_error("Not all threads died properly\n");
+  for (Thread_info *ti= head.next; ti != &head; ti= ti->next)
+  {
+    log_error("Thread_registry: unregistered thread: %lu.",
+              (unsigned long) ti->thread_id);
+  }
+
   /* All threads must unregister */
   DBUG_ASSERT(head.next == &head);
 
Thread
bk commit into 5.1 tree (anozdrin:1.2561) BUG#28030Alexander Nozdrin26 Jul
  • Re: bk commit into 5.1 tree (anozdrin:1.2561) BUG#28030Konstantin Osipov26 Jul
  • Re: bk commit into 5.1 tree (anozdrin:1.2561) BUG#28030Konstantin Osipov27 Jul