MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Petr Chardin Date:October 5 2006 6:07pm
Subject:bk commit into 5.0 tree (petr:1.2276) BUG#19368
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cps. When cps 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-10-05 22:07:21+04:00, petr@stripped +2 -0
  Fix Bug #19368 Failure in "flush_instances" causes assert in Thread_registry
  
  Stop guardian and all the rest of threads before shutdown in case of an error

  server-tools/instance-manager/instance_map.cc@stripped, 2006-10-05 22:07:17+04:00, petr@stripped +3 -1
    flush_instances shouldn't reinit guardian, if it
    failed to load info about them

  server-tools/instance-manager/manager.cc@stripped, 2006-10-05 22:07:17+04:00, petr@stripped +17 -1
    On error we should 1) stop guardian 2) terminate all
    other threads and exit

# 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:	petr
# Host:	owlet.local
# Root:	/home/cps/mysql/trees/mysql-5.0-virgin

--- 1.34/server-tools/instance-manager/manager.cc	2006-10-05 22:07:28 +04:00
+++ 1.35/server-tools/instance-manager/manager.cc	2006-10-05 22:07:28 +04:00
@@ -104,6 +104,19 @@ int my_sigwait(const sigset_t *set, int 
 #endif
 
 
+void stop_all(Guardian_thread *guardian, Thread_registry *registry)
+{
+  /*
+    Let guardian thread know that it should break it's processing cycle,
+    once it wakes up.
+  */
+  guardian->request_shutdown(true);
+  /* wake guardian */
+  pthread_cond_signal(&guardian->COND_guardian);
+  /* stop all threads */
+  registry->deliver_shutdown();
+}
+
 /*
   manager - entry point to the main instance manager process: start
   listener thread, write pid file and enter into signal handling.
@@ -210,7 +223,8 @@ void manager(const Options &options)
     log_error("Cannot init instances repository. This might be caused by "
                "the wrong config file options. For instance, missing mysqld "
                "binary. Aborting.");
-    return;
+    stop_all(&guardian_thread, &thread_registry);
+    goto err;
   }
 
   /* create the listener */
@@ -227,6 +241,7 @@ void manager(const Options &options)
     if (rc)
     {
       log_error("manager(): set_stacksize_n_create_thread(listener) failed");
+      stop_all(&guardian_thread, &thread_registry);
       goto err;
     }
 
@@ -245,6 +260,7 @@ void manager(const Options &options)
     if ((status= my_sigwait(&mask, &signo)) != 0)
     {
       log_error("sigwait() failed");
+      stop_all(&guardian_thread, &thread_registry);
       goto err;
     }
 

--- 1.27/server-tools/instance-manager/instance_map.cc	2006-10-05 22:07:28 +04:00
+++ 1.28/server-tools/instance-manager/instance_map.cc	2006-10-05 22:07:28 +04:00
@@ -215,7 +215,9 @@ int Instance_map::flush_instances()
   hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0,
             get_instance_key, delete_instance, 0);
   rc= load();
-  guardian->init(); // TODO: check error status.
+  /* don't init guardian if we failed to load instances */
+  if (!rc)
+    guardian->init(); // TODO: check error status.
   pthread_mutex_unlock(&LOCK_instance_map);
   guardian->unlock();
   return rc;
Thread
bk commit into 5.0 tree (petr:1.2276) BUG#19368Petr Chardin5 Oct