You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2009/05/20 20:19:44 UTC

svn commit: r776799 - in /qpid/trunk/qpid/cpp/src/qpid/cluster: Cluster.cpp ClusterPlugin.cpp ClusterSettings.h ErrorCheck.cpp

Author: aconway
Date: Wed May 20 18:19:44 2009
New Revision: 776799

URL: http://svn.apache.org/viewvc?rev=776799&view=rev
Log:
Add missing null body check in ErrorCheck

Make error checking optional.
This is temporary until all issues with it are worked out.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
    qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp
    qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterSettings.h
    qpid/trunk/qpid/cpp/src/qpid/cluster/ErrorCheck.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp?rev=776799&r1=776798&r2=776799&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp Wed May 20 18:19:44 2009
@@ -338,7 +338,8 @@
 
 void Cluster::flagError(Connection& connection, ErrorCheck::ErrorType type) {
     Mutex::ScopedLock l(lock);
-    error.error(connection, type, map.getFrameSeq(), map.getMembers());
+    if (settings.checkErrors)
+        error.error(connection, type, map.getFrameSeq(), map.getMembers());
 }
 
 LATENCY_TRACK(sys::LatencyTracker<const AMQBody*> doOutputTracker("DoOutput");)
@@ -350,9 +351,14 @@
     LATENCY_TRACK(if (e.frame.getBody()->type() == CONTENT_BODY) doOutputTracker.start(e.frame.getBody()));
     Mutex::ScopedLock l(lock);
     // Process each frame through the error checker.
-    error.delivered(e);
-    while (error.canProcess())  // There is a frame ready to process.
-        processFrame(error.getNext(), l);
+    if (settings.checkErrors) {
+        error.delivered(e);
+        while (error.canProcess())  // There is a frame ready to process.
+            processFrame(error.getNext(), l);
+    }
+    else {
+        processFrame(e, l);
+    }
 }
 
 LATENCY_TRACK(sys::LatencyStatistic processLatency("Process");)
@@ -707,7 +713,7 @@
     };
     assert(sizeof(STATE)/sizeof(*STATE) == Cluster::LEFT+1);
     o << cluster.self << "(" << STATE[cluster.state];
-    if (cluster.error.isUnresolved()) o << "/error";
+    if (cluster.settings.checkErrors && cluster.error.isUnresolved()) o << "/error";
     return o << ")";
 }
 

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp?rev=776799&r1=776798&r2=776799&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp Wed May 20 18:19:44 2009
@@ -76,6 +76,8 @@
              "Experimental: initial estimate for write rate per multicast cycle")
             ("cluster-write-min", optValue(settings.writeMin, "Kb"),
              "Experimental: minimum estimate for write rate per multicast cycle")
+            // FIXME aconway 2009-05-20: temporary
+            ("cluster-check-errors", optValue(settings.checkErrors, "yes|no"), "Enable/disable cluster error checks. Normally should be enabled.")
             ;
     }
 };

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterSettings.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterSettings.h?rev=776799&r1=776798&r2=776799&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterSettings.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/ClusterSettings.h Wed May 20 18:19:44 2009
@@ -34,8 +34,11 @@
     bool quorum;
     size_t readMax, writeEstimate, writeMin;
     std::string username, password, mechanism;
+    bool checkErrors;
 
-    ClusterSettings() : quorum(false), readMax(10), writeEstimate(1), writeMin(1) {}
+    ClusterSettings() : quorum(false), readMax(10), writeEstimate(1), writeMin(1),
+                        checkErrors(true) // FIXME aconway 2009-05-20: temporary
+    {}
   
     Url getUrl(uint16_t port) const {
         if (url.empty()) return Url::getIpAddressesUrl(port);

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/ErrorCheck.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/ErrorCheck.cpp?rev=776799&r1=776798&r2=776799&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/ErrorCheck.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/ErrorCheck.cpp Wed May 20 18:19:44 2009
@@ -60,11 +60,9 @@
 
 void ErrorCheck::delivered(const EventFrame& e) {
     if (isUnresolved()) {
-        const ClusterErrorCheckBody* errorCheck =
-            dynamic_cast<const ClusterErrorCheckBody*>(e.frame.getMethod());
-        const ClusterConfigChangeBody* configChange =
-            dynamic_cast<const ClusterConfigChangeBody*>(e.frame.getMethod());
-
+        const ClusterErrorCheckBody* errorCheck = 0;
+        if (e.frame.getBody())
+            errorCheck = dynamic_cast<const ClusterErrorCheckBody*>(e.frame.getMethod());
         if (errorCheck && errorCheck->getFrameSeq() == frameSeq) { // Same error
             if (errorCheck->getType() < type) { // my error is worse than his
                 QPID_LOG(critical, cluster << " Error " << frameSeq << " did not occur on " << e.getMemberId());
@@ -78,6 +76,9 @@
         }
         else {
             frames.push_back(e); // Only drop matching errorCheck controls.
+            const ClusterConfigChangeBody* configChange = 0;
+            if (e.frame.getBody())
+                configChange = dynamic_cast<const ClusterConfigChangeBody*>(e.frame.getMethod());
             if (configChange) {
                 MemberSet members(ClusterMap::decode(configChange->getCurrent()));
                 MemberSet result;



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