qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1409327 - in /qpid/trunk/qpid/cpp/src/qpid/ha: HaPlugin.cpp QueueReplicator.cpp types.cpp types.h
Date Wed, 14 Nov 2012 19:51:38 GMT
Author: aconway
Date: Wed Nov 14 19:51:37 2012
New Revision: 1409327

URL: http://svn.apache.org/viewvc?rev=1409327&view=rev
Log:
QPID-4436: HA fix qpidd crash when mgmt-enable=no

- Don't initialize HaBroker if management is disabled.
- Fix use of constants from another compilation unit in QueueReplicator.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/ha/HaPlugin.cpp
    qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
    qpid/trunk/qpid/cpp/src/qpid/ha/types.cpp
    qpid/trunk/qpid/cpp/src/qpid/ha/types.h

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/HaPlugin.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/HaPlugin.cpp?rev=1409327&r1=1409326&r2=1409327&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/HaPlugin.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/HaPlugin.cpp Wed Nov 14 19:51:37 2012
@@ -69,10 +69,16 @@ struct HaPlugin : public Plugin {
     void earlyInitialize(Plugin::Target& target) {
         broker::Broker* broker = dynamic_cast<broker::Broker*>(&target);
         if (broker) {
-            // Must create the HaBroker in earlyInitialize so it can set up its
-            // connection observer before clients start connecting.
-            haBroker.reset(new ha::HaBroker(*broker, settings));
-            broker->addFinalizer(boost::bind(&HaPlugin::finalize, this));
+            if (!broker->getManagementAgent()) {
+                QPID_LOG(info, "HA plugin disabled because management is disabled");
+                if (settings.cluster)
+                    throw Exception("Cannot start HA: management is disabled");
+            } else {
+                // Must create the HaBroker in earlyInitialize so it can set up its
+                // connection observer before clients start connecting.
+                haBroker.reset(new ha::HaBroker(*broker, settings));
+                broker->addFinalizer(boost::bind(&HaPlugin::finalize, this));
+            }
         }
     }
 

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.cpp?rev=1409327&r1=1409326&r2=1409327&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.cpp Wed Nov 14 19:51:37 2012
@@ -40,6 +40,7 @@
 namespace {
 const std::string QPID_REPLICATOR_("qpid.replicator-");
 const std::string TYPE_NAME("qpid.queue-replicator");
+const std::string QPID_HA("qpid.ha-");
 }
 
 namespace qpid {
@@ -49,8 +50,8 @@ using namespace framing;
 using namespace std;
 using sys::Mutex;
 
-const std::string QueueReplicator::DEQUEUE_EVENT_KEY(QPID_HA_PREFIX+"dequeue");
-const std::string QueueReplicator::POSITION_EVENT_KEY(QPID_HA_PREFIX+"position");
+const std::string QueueReplicator::DEQUEUE_EVENT_KEY(QPID_HA+"dequeue");
+const std::string QueueReplicator::POSITION_EVENT_KEY(QPID_HA+"position");
 const std::string QueueReplicator::QPID_SYNC_FREQUENCY("qpid.sync_frequency");
 
 std::string QueueReplicator::replicatorName(const std::string& queueName) {
@@ -62,7 +63,7 @@ bool QueueReplicator::isReplicatorName(c
 }
 
 bool QueueReplicator::isEventKey(const std::string key) {
-    const std::string& prefix = QPID_HA_PREFIX;
+    const std::string& prefix = QPID_HA;
     bool ret = key.size() > prefix.size() && key.compare(0, prefix.size(), prefix)
== 0;
     return ret;
 }

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/types.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/types.cpp?rev=1409327&r1=1409326&r2=1409327&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/types.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/types.cpp Wed Nov 14 19:51:37 2012
@@ -33,8 +33,7 @@ namespace ha {
 using namespace std;
 
 const string QPID_REPLICATE("qpid.replicate");
-const string QPID_HA_PREFIX("qpid.ha-");
-const string QPID_HA_UUID(QPID_HA_PREFIX+"uuid");
+const string QPID_HA_UUID("qpid.ha-uuid");
 
 string EnumBase::str() const {
     assert(value < count);

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/types.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/types.h?rev=1409327&r1=1409326&r2=1409327&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/types.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/types.h Wed Nov 14 19:51:37 2012
@@ -99,7 +99,6 @@ inline bool isBackup(BrokerStatus s) { r
 
 // String constants.
 extern const std::string QPID_REPLICATE;
-extern const std::string QPID_HA_PREFIX;
 extern const std::string QPID_HA_UUID;
 
 /** Define IdSet type, not a typedef so we can overload operator << */



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message