List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:November 3 2010 11:48am
Subject:bzr push into mysql-5.1-telco-6.3 branch (magnus.blaudd:3331 to 3332)
View as plain text  
 3332 Magnus Blåudd	2010-11-03 [merge]
      Merge in patch for bug53456

    modified:
      storage/ndb/src/kernel/main.cpp
 3331 jonas oreland	2010-11-01
      ndb - bug#57896 - LQHKEYREQ only contains 16-bit schema version

    modified:
      storage/ndb/include/kernel/signaldata/LqhKey.hpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
=== modified file 'storage/ndb/src/kernel/main.cpp'
--- a/storage/ndb/src/kernel/main.cpp	2010-09-22 09:16:46 +0000
+++ b/storage/ndb/src/kernel/main.cpp	2010-11-03 11:00:50 +0000
@@ -235,6 +235,37 @@ do_next:
   return 0;
 }
 
+
+/*
+  retry failed fork after sleep until fork suceeds or
+  max number of retries occurs
+*/
+
+static pid_t
+retry_fork(void)
+{
+  const unsigned max_retries = 10;
+  unsigned retry_counter = 0;
+  while(true)
+  {
+    pid_t pid = fork();
+    if (pid == -1)
+    {
+      g_eventLogger->warning("Angel failed to fork, errno: %d", errno);
+
+      if (retry_counter++ == max_retries)
+      {
+        g_eventLogger->error("Angel failed to fork %d times, giving up",
+                             retry_counter);
+        exit(-1);
+      }
+      NdbSleep_SecSleep(1);
+      continue;
+    }
+    return pid;
+  }
+}
+
 extern int g_ndb_init_need_monotonic;
 
 int main(int argc, char** argv)
@@ -308,8 +339,10 @@ int main(int argc, char** argv)
       }
     }
 
-    if ((child = fork()) <= 0)
-      break; // child or error
+    child = retry_fork();
+    if (child == 0)
+      break; // child
+    assert(child > 0);
 
     /**
      * Parent

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-6.3 branch (magnus.blaudd:3331 to 3332) Magnus Blåudd3 Nov