List:Commits« Previous MessageNext Message »
From:Maitrayi Sabaratnam Date:September 25 2012 11:14am
Subject:bzr push into mysql-5.1-telco-7.0 branch (maitrayi.sabaratnam:4989 to 4990)
Bug#14329309
View as plain text  
 4990 Maitrayi Sabaratnam	2012-09-25
      Bug#14329309 - ADD NUMBER OF RETRIES AND DELAY BETWEEN RETRIES AS START OPTIONS TO NDBD

    modified:
      storage/ndb/src/kernel/angel.cpp
      storage/ndb/src/kernel/angel.hpp
      storage/ndb/src/kernel/main.cpp
      storage/ndb/src/kernel/ndbd.cpp
      storage/ndb/src/kernel/ndbd.hpp
      storage/ndb/src/kernel/vm/Configuration.cpp
      storage/ndb/src/kernel/vm/Configuration.hpp
      storage/ndb/src/mgmapi/mgmapi.cpp
 4989 Mauritz Sundell	2012-09-21
      ndb - regenerate result for test ndb.ndb_native_default_support

    modified:
      mysql-test/suite/ndb/r/ndb_native_default_support.result
=== modified file 'storage/ndb/src/kernel/angel.cpp'
--- a/storage/ndb/src/kernel/angel.cpp	2011-09-08 09:04:25 +0000
+++ b/storage/ndb/src/kernel/angel.cpp	2012-09-25 10:35:15 +0000
@@ -543,7 +543,9 @@ angel_run(const char* progname,
           const char* bind_address,
           bool initial,
           bool no_start,
-          bool daemon)
+          bool daemon,
+          int connnect_retries,
+          int connect_delay)
 {
   ConfigRetriever retriever(connect_str,
                             force_nodeid,
@@ -557,8 +559,6 @@ angel_run(const char* progname,
     angel_exit(1);
   }
 
-  const int connnect_retries = 12;
-  const int connect_delay = 5;
   const int verbose = 1;
   if (retriever.do_connect(connnect_retries, connect_delay, verbose) != 0)
   {
@@ -825,8 +825,6 @@ angel_run(const char* progname,
       NdbSleep_SecSleep(restart_delay_secs);
     };
 
-    const int connnect_retries = 12;
-    const int connect_delay = 5;
     const int verbose = 1;
     if (retriever.do_connect(connnect_retries, connect_delay, verbose) != 0)
     {

=== modified file 'storage/ndb/src/kernel/angel.hpp'
--- a/storage/ndb/src/kernel/angel.hpp	2011-01-30 23:13:49 +0000
+++ b/storage/ndb/src/kernel/angel.hpp	2012-09-25 10:35:15 +0000
@@ -26,7 +26,9 @@ angel_run(const char* progname,
           const char* bind_address,
           bool initial,
           bool no_start,
-          bool daemon);
+          bool daemon,
+          int connnect_retries,
+          int connect_delay);
 
 void
 angel_stop(void);

=== modified file 'storage/ndb/src/kernel/main.cpp'
--- a/storage/ndb/src/kernel/main.cpp	2012-07-05 11:19:04 +0000
+++ b/storage/ndb/src/kernel/main.cpp	2012-09-25 10:35:15 +0000
@@ -34,6 +34,8 @@ static int opt_report_fd;
 static int opt_initial;
 static int opt_no_start;
 static unsigned opt_allocated_nodeid;
+static int opt_retries;
+static int opt_delay;
 
 extern NdbNodeBitmask g_nowait_nodes;
 
@@ -86,6 +88,14 @@ static struct my_option my_long_options[
     "INTERNAL: nodeid allocated by angel process",
     (uchar**) &opt_allocated_nodeid, (uchar**) &opt_allocated_nodeid, 0,
     GET_UINT, REQUIRED_ARG, 0, 0, ~0, 0, 0, 0 },
+  { "connect-retries", 'r',
+    "Number of times mgmd is contacted at start. -1: eternal retries",
+    (uchar**) &opt_retries, (uchar**) &opt_retries, 0,
+    GET_INT, REQUIRED_ARG, 12, -1, 65535, 0, 0, 0 },
+  { "connect-delay", NDB_OPT_NOSHORT,
+    "Number of seconds between each connection attempt",
+    (uchar**) &opt_delay, (uchar**) &opt_delay, 0,
+    GET_INT, REQUIRED_ARG, 5, 0, 3600, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -187,7 +197,7 @@ real_main(int argc, char** argv)
     ndbd_run(opt_foreground, opt_report_fd,
              opt_ndb_connectstring, opt_ndb_nodeid, opt_bind_address,
              opt_no_start, opt_initial, opt_initialstart,
-             opt_allocated_nodeid);
+             opt_allocated_nodeid, opt_retries, opt_delay);
   }
 
   angel_run(progname,
@@ -197,7 +207,9 @@ real_main(int argc, char** argv)
             opt_bind_address,
             opt_initial,
             opt_no_start,
-            opt_daemon);
+            opt_daemon,
+            opt_retries,
+            opt_delay);
 
   return 1; // Never reached
 }

=== modified file 'storage/ndb/src/kernel/ndbd.cpp'
--- a/storage/ndb/src/kernel/ndbd.cpp	2012-02-03 11:00:32 +0000
+++ b/storage/ndb/src/kernel/ndbd.cpp	2012-09-25 10:35:15 +0000
@@ -559,7 +559,7 @@ void
 ndbd_run(bool foreground, int report_fd,
          const char* connect_str, int force_nodeid, const char* bind_address,
          bool no_start, bool initial, bool initialstart,
-         unsigned allocated_nodeid)
+         unsigned allocated_nodeid, int connect_retries, int connect_delay)
 {
 #ifdef _WIN32
   {
@@ -622,7 +622,8 @@ ndbd_run(bool foreground, int report_fd,
   }
 
   theConfig->fetch_configuration(connect_str, force_nodeid, bind_address,
-                                 allocated_nodeid);
+                                 allocated_nodeid, connect_retries,
+                                 connect_delay);
 
   if (NdbDir::chdir(NdbConfig_get_path(NULL)) != 0)
   {

=== modified file 'storage/ndb/src/kernel/ndbd.hpp'
--- a/storage/ndb/src/kernel/ndbd.hpp	2011-01-30 23:13:49 +0000
+++ b/storage/ndb/src/kernel/ndbd.hpp	2012-09-25 10:35:15 +0000
@@ -20,7 +20,7 @@ void
 ndbd_run(bool foreground, int report_fd,
          const char* connect_str, int force_nodeid, const char* bind_address,
          bool no_start, bool initial, bool initialstart,
-         unsigned allocated_nodeid);
+         unsigned allocated_nodeid, int connect_retries, int connect_delay);
 
 enum NdbShutdownType {
   NST_Normal,

=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp	2012-09-19 06:37:24 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp	2012-09-25 10:35:15 +0000
@@ -117,7 +117,8 @@ void
 Configuration::fetch_configuration(const char* _connect_string,
                                    int force_nodeid,
                                    const char* _bind_address,
-                                   NodeId allocated_nodeid)
+                                   NodeId allocated_nodeid,
+                                   int connect_retries, int connect_delay)
 {
   /**
    * Fetch configuration from management server
@@ -144,7 +145,7 @@ Configuration::fetch_configuration(const
 	      m_config_retriever->getErrorString());
   }
 
-  if(m_config_retriever->do_connect(12,5,1) == -1){
+  if(m_config_retriever->do_connect(connect_retries, connect_delay, 1) == -1){
     const char * s = m_config_retriever->getErrorString();
     if(s == 0)
       s = "No error given!";

=== modified file 'storage/ndb/src/kernel/vm/Configuration.hpp'
--- a/storage/ndb/src/kernel/vm/Configuration.hpp	2011-09-02 17:24:52 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.hpp	2012-09-25 10:35:15 +0000
@@ -61,7 +61,8 @@ public:
 
   void fetch_configuration(const char* _connect_string, int force_nodeid,
                            const char* _bind_adress,
-                           NodeId allocated_nodeid);
+                           NodeId allocated_nodeid,
+                           int connect_retries, int connect_delay);
   void setupConfiguration();
   void closeConfiguration(bool end_session= true);
   

=== modified file 'storage/ndb/src/mgmapi/mgmapi.cpp'
--- a/storage/ndb/src/mgmapi/mgmapi.cpp	2011-10-24 07:44:52 +0000
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp	2012-09-25 10:35:15 +0000
@@ -661,6 +661,9 @@ bool get_mgmd_version(NdbMgmHandle handl
 
 /**
  * Connect to a management server
+ * no_retries = 0, return immediately,
+ * no_retries < 0, retry infinitely,
+ * else retry no_retries times.
  */
 extern "C"
 int
@@ -795,6 +798,15 @@ ndb_mgm_connect(NdbMgmHandle handle, int
       }
       no_retries--;
     }
+    else
+    {
+      // no_retries < 0, retrying infinitely
+      if (verbose == -2)
+      {
+        fprintf(handle->errstream, ".");
+        fflush(handle->errstream);
+      }
+    }
     NdbSleep_SecSleep(retry_delay_in_seconds);
   }
   if (verbose == -2)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (maitrayi.sabaratnam:4989 to 4990)Bug#14329309Maitrayi Sabaratnam26 Sep