MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:June 19 2006 10:16am
Subject:bk commit into 5.0 tree (anozdrin:1.2171) BUG#19391
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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
  1.2171 06/06/19 14:16:10 anozdrin@stripped +3 -0
  The second fix for BUG#19391: IM fails to start after two executions.

  server-tools/instance-manager/manager.cc
    1.34 06/06/19 14:16:06 anozdrin@stripped +31 -12
    Make initialization of alarm infrustructure before starting Guardian
    thread, because Guardian uses thr_alarm().

  server-tools/instance-manager/instance_map.cc
    1.27 06/06/19 14:16:06 anozdrin@stripped +1 -1
    Added TODO comment.

  server-tools/instance-manager/guardian.cc
    1.22 06/06/19 14:16:05 anozdrin@stripped +0 -3
    Removed erroneous unlock() in Guardian_thread::init():
    instance_map is unlocked in the caller.

# 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:	anozdrin
# Host:	booka
# Root:	/home/alik/MySQL/devel/5.0-rt-bug18023

--- 1.33/server-tools/instance-manager/manager.cc	2006-05-29 17:26:50 +04:00
+++ 1.34/server-tools/instance-manager/manager.cc	2006-06-19 14:16:06 +04:00
@@ -147,6 +147,25 @@ void manager(const Options &options)
   if (create_pid_file(options.pid_file_name, manager_pid))
     return;
 
+  /*
+    Initialize signals and alarm-infrastructure.
+
+    NOTE: To work nicely with LinuxThreads, the signal thread is the first
+    thread in the process.
+
+    NOTE:
+      After init_thr_alarm() call it's possible to call thr_alarm() (from
+      different threads), that results in sending ALARM signal to the alarm
+      thread (which can be the main thread). That signal can interrupt
+      blocking calls.
+
+      In other words, a blocking call can be interrupted in the main thread
+      after init_thr_alarm().
+  */
+
+  sigset_t mask;
+  set_signals(&mask);
+
   /* create guardian thread */
   {
     pthread_t guardian_thd_id;
@@ -154,9 +173,16 @@ void manager(const Options &options)
     int rc;
 
     /*
-       NOTE: Guardian should be shutdown first. Only then all other threads
-       need to be stopped. This should be done, as guardian is responsible for
-       shutting down the instances, and this is a long operation.
+      NOTE: Guardian should be shutdown first. Only then all other threads
+      need to be stopped. This should be done, as guardian is responsible
+      for shutting down the instances, and this is a long operation.
+
+      NOTE: Guardian uses thr_alarm() when detects current state of
+      instances (is_running()), but it is not interfere with
+      flush_instances() later in the code, because until flush_instances()
+      complete in the main thread, Guardian thread is not permitted to
+      process instances. And before flush_instances() there is no instances
+      to proceed.
     */
 
     pthread_attr_init(&guardian_thd_attr);
@@ -172,10 +198,8 @@ void manager(const Options &options)
 
   }
 
-  /*
-    To work nicely with LinuxThreads, the signal thread is the first thread
-    in the process.
-  */
+  /* Load instances. */
+
   int signo;
   bool shutdown_complete;
 
@@ -188,11 +212,6 @@ void manager(const Options &options)
                "binary. Aborting.");
     return;
   }
-
-  /* Initialize signals and alarm-infrastructure. */
-
-  sigset_t mask;
-  set_signals(&mask);
 
   /* create the listener */
   {

--- 1.21/server-tools/instance-manager/guardian.cc	2006-05-29 17:30:27 +04:00
+++ 1.22/server-tools/instance-manager/guardian.cc	2006-06-19 14:16:05 +04:00
@@ -271,10 +271,7 @@ int Guardian_thread::init()
   {
     if (!(instance->options.nonguarded))
       if (guard(instance, TRUE))                /* do not lock guardian */
-      {
-        instance_map->unlock();
         return 1;
-      }
   }
 
   return 0;

--- 1.26/server-tools/instance-manager/instance_map.cc	2006-02-21 15:59:35 +03:00
+++ 1.27/server-tools/instance-manager/instance_map.cc	2006-06-19 14:16:06 +04:00
@@ -215,7 +215,7 @@ 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();
+  guardian->init(); // TODO: check error status.
   pthread_mutex_unlock(&LOCK_instance_map);
   guardian->unlock();
   return rc;
Thread
bk commit into 5.0 tree (anozdrin:1.2171) BUG#19391Alexander Nozdrin19 Jun