qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r744321 - in /qpid/trunk/qpid/cpp/src/qpid/cluster: Cpg.cpp Quorum_cman.cpp
Date Sat, 14 Feb 2009 00:47:05 GMT
Author: aconway
Date: Sat Feb 14 00:47:05 2009
New Revision: 744321

URL: http://svn.apache.org/viewvc?rev=744321&view=rev
Log:
Cluster start-up retries to  handle slow cman start-up.
 - infinite retry if cpg_initialize returns TRY_AGAIN.
 - infinite retry for cman_is_quorate

Modified:
    qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp
    qpid/trunk/qpid/cpp/src/qpid/cluster/Quorum_cman.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp?rev=744321&r1=744320&r2=744321&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp Sat Feb 14 00:47:05 2009
@@ -18,6 +18,7 @@
 
 #include "Cpg.h"
 #include "qpid/sys/Mutex.h"
+#include "qpid/sys/Time.h"
 #include "qpid/sys/posix/PrivatePosix.h"
 #include "qpid/log/Statement.h"
 
@@ -74,7 +75,13 @@
     ::memset(&callbacks, sizeof(callbacks), 0);
     callbacks.cpg_deliver_fn = &globalDeliver;
     callbacks.cpg_confchg_fn = &globalConfigChange;
-    check(cpg_initialize(&handle, &callbacks), "Cannot initialize CPG");
+    cpg_error_t err = cpg_initialize(&handle, &callbacks);
+    if (err == CPG_ERR_TRY_AGAIN) {
+        QPID_LOG(notice, "Waiting for CPG initialization.");
+        while (CPG_ERR_TRY_AGAIN == (err = cpg_initialize(&handle, &callbacks)))
+            sys::sleep(5);
+    }
+    check(err, "Failed to initialize CPG.");
     check(cpg_context_set(handle, this), "Cannot set CPG context");
     // Note: CPG is currently unix-specific. If CPG is ported to
     // windows then this needs to be refactored into

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Quorum_cman.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Quorum_cman.cpp?rev=744321&r1=744320&r2=744321&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/Quorum_cman.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/Quorum_cman.cpp Sat Feb 14 00:47:05 2009
@@ -35,13 +35,10 @@
     enable = true;
     cman = cman_init(0);
     if (cman == 0) throw ErrnoException("Can't connect to cman service");
-    // TODO aconway 2008-11-13: configurable max wait.
-    for (int retry = 0;  !cman_is_quorate(cman) && retry < 30; retry++) {
-        QPID_LOG(info, "Waiting for cluster quorum: " << sys::strError(errno));
-        sys::sleep(1);
+    if (!cman_is_quorate(cman)) {
+        QPID_LOG(notice, "Waiting for cluster quorum.");
+        while(!cman_is_quorate(cman)) sys::sleep(5);
     }
-    if (!cman_is_quorate(cman))
-        throw ErrnoException("Timed out waiting for cluster quorum.");
 }
 
 bool Quorum::isQuorate() { return enable ? cman_is_quorate(cman) : true; }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message