summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2011-08-31 19:49:04 +0000
committerAlan Conway <aconway@apache.org>2011-08-31 19:49:04 +0000
commit61765683737ee5c0a494a650440c78ef81267314 (patch)
treeeddfce3ba8f963d5595b9d14852ff96483803b6b
parent49e1f713bcbec4b7eec064c999e4a4a91603b7b9 (diff)
downloadqpid-python-61765683737ee5c0a494a650440c78ef81267314.tar.gz
NO-JIRA: Suppress logging of clock events in cluster code.
Clock events are much too frequent to log, doing so makes trace logging useless for clustered brokers. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1163766 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/cluster/Cluster.cpp15
-rw-r--r--qpid/cpp/src/qpid/cluster/Cluster.h34
-rw-r--r--qpid/cpp/src/qpid/cluster/Connection.cpp2
-rw-r--r--qpid/cpp/src/qpid/cluster/Multicaster.cpp3
4 files changed, 34 insertions, 20 deletions
diff --git a/qpid/cpp/src/qpid/cluster/Cluster.cpp b/qpid/cpp/src/qpid/cluster/Cluster.cpp
index 1c398d63f4..7432fbbc33 100644
--- a/qpid/cpp/src/qpid/cluster/Cluster.cpp
+++ b/qpid/cpp/src/qpid/cluster/Cluster.cpp
@@ -526,7 +526,7 @@ void Cluster::deliveredFrame(const EventFrame& efConst) {
void Cluster::processFrame(const EventFrame& e, Lock& l) {
if (e.isCluster()) {
- QPID_LOG(trace, *this << " DLVR: " << e);
+ QPID_LOG_IF(trace, loggable(e.frame), *this << " DLVR: " << e);
ClusterDispatcher dispatch(*this, e.connectionId.getMember(), l);
if (!framing::invoke(dispatch, *e.frame.getBody()).wasHandled())
throw Exception(QPID_MSG("Invalid cluster control"));
@@ -535,14 +535,15 @@ void Cluster::processFrame(const EventFrame& e, Lock& l) {
map.incrementFrameSeq();
ConnectionPtr connection = getConnection(e, l);
if (connection) {
- QPID_LOG(trace, *this << " DLVR " << map.getFrameSeq() << ": " << e);
+ QPID_LOG_IF(trace, loggable(e.frame),
+ *this << " DLVR " << map.getFrameSeq() << ": " << e);
connection->deliveredFrame(e);
}
else
throw Exception(QPID_MSG("Unknown connection: " << e));
}
else // Drop connection frames while state < CATCHUP
- QPID_LOG(trace, *this << " DROP (joining): " << e);
+ QPID_LOG_IF(trace, loggable(e.frame), *this << " DROP (joining): " << e);
}
// Called in deliverFrameQueue thread
@@ -1219,4 +1220,12 @@ bool Cluster::deferDeliveryImpl(const std::string& queue,
return true;
}
+bool Cluster::loggable(const AMQFrame& f) {
+ const AMQMethodBody* method = (f.getMethod());
+ if (!method) return true; // Not a method
+ bool isClock = method->amqpClassId() == ClusterClockBody::CLASS_ID
+ && method->amqpMethodId() == ClusterClockBody::METHOD_ID;
+ return !isClock;
+}
+
}} // namespace qpid::cluster
diff --git a/qpid/cpp/src/qpid/cluster/Cluster.h b/qpid/cpp/src/qpid/cluster/Cluster.h
index adb06b2783..da5781b7a9 100644
--- a/qpid/cpp/src/qpid/cluster/Cluster.h
+++ b/qpid/cpp/src/qpid/cluster/Cluster.h
@@ -59,6 +59,7 @@ class Message;
}
namespace framing {
+class AMQFrame;
class AMQBody;
struct Uuid;
}
@@ -95,10 +96,10 @@ class Cluster : private Cpg::Handler, public management::Manageable {
void initialize();
// Connection map.
- void addLocalConnection(const ConnectionPtr&);
- void addShadowConnection(const ConnectionPtr&);
- void erase(const ConnectionId&);
-
+ void addLocalConnection(const ConnectionPtr&);
+ void addShadowConnection(const ConnectionPtr&);
+ void erase(const ConnectionId&);
+
// URLs of current cluster members.
std::vector<std::string> getIds() const;
std::vector<Url> getUrls() const;
@@ -113,7 +114,7 @@ class Cluster : private Cpg::Handler, public management::Manageable {
void updateInRetracted();
// True if we are expecting to receive catch-up connections.
bool isExpectingUpdate();
-
+
MemberId getId() const;
broker::Broker& getBroker() const;
Multicaster& getMulticast() { return mcast; }
@@ -144,6 +145,9 @@ class Cluster : private Cpg::Handler, public management::Manageable {
sys::AbsTime getClusterTime();
void sendClockUpdate();
void clock(const uint64_t time);
+
+ static bool loggable(const framing::AMQFrame&); // True if the frame should be logged.
+
private:
typedef sys::Monitor::ScopedLock Lock;
@@ -153,10 +157,10 @@ class Cluster : private Cpg::Handler, public management::Manageable {
/** Version number of the cluster protocol, to avoid mixed versions. */
static const uint32_t CLUSTER_VERSION;
-
+
// NB: A dummy Lock& parameter marks functions that must only be
// called with Cluster::lock locked.
-
+
void leave(Lock&);
std::vector<std::string> getIds(Lock&) const;
std::vector<Url> getUrls(Lock&) const;
@@ -165,11 +169,11 @@ class Cluster : private Cpg::Handler, public management::Manageable {
void brokerShutdown();
// == Called in deliverEventQueue thread
- void deliveredEvent(const Event&);
+ void deliveredEvent(const Event&);
// == Called in deliverFrameQueue thread
- void deliveredFrame(const EventFrame&);
- void processFrame(const EventFrame&, Lock&);
+ void deliveredFrame(const EventFrame&);
+ void processFrame(const EventFrame&, Lock&);
// Cluster controls implement XML methods from cluster.xml.
void updateRequest(const MemberId&, const std::string&, Lock&);
@@ -204,7 +208,7 @@ class Cluster : private Cpg::Handler, public management::Manageable {
void setReady(Lock&);
void memberUpdate(Lock&);
void setClusterId(const framing::Uuid&, Lock&);
- void erase(const ConnectionId&, Lock&);
+ void erase(const ConnectionId&, Lock&);
void requestUpdate(Lock& );
void initMapCompleted(Lock&);
void becomeElder(Lock&);
@@ -212,7 +216,7 @@ class Cluster : private Cpg::Handler, public management::Manageable {
void updateMgmtMembership(Lock&);
// == Called in CPG dispatch thread
- void deliver( // CPG deliver callback.
+ void deliver( // CPG deliver callback.
cpg_handle_t /*handle*/,
const struct cpg_name *group,
uint32_t /*nodeid*/,
@@ -221,7 +225,7 @@ class Cluster : private Cpg::Handler, public management::Manageable {
int /*msg_len*/);
void deliverEvent(const Event&);
-
+
void configChange( // CPG config change callback.
cpg_handle_t /*handle*/,
const struct cpg_name */*group*/,
@@ -272,7 +276,7 @@ class Cluster : private Cpg::Handler, public management::Manageable {
// Used only in deliverEventQueue thread or when stalled for update.
Decoder decoder;
bool discarding;
-
+
// Remaining members are protected by lock.
mutable sys::Monitor lock;
@@ -285,7 +289,7 @@ class Cluster : private Cpg::Handler, public management::Manageable {
JOINER, ///< Sent update request, waiting for update offer.
UPDATEE, ///< Stalled receive queue at update offer, waiting for update to complete.
CATCHUP, ///< Update complete, unstalled but has not yet seen own "ready" event.
- READY, ///< Fully operational
+ READY, ///< Fully operational
OFFER, ///< Sent an offer, waiting for accept/reject.
UPDATER, ///< Offer accepted, sending a state update.
LEFT ///< Final state, left the cluster.
diff --git a/qpid/cpp/src/qpid/cluster/Connection.cpp b/qpid/cpp/src/qpid/cluster/Connection.cpp
index e0ce8cf9e0..0feb4c19ff 100644
--- a/qpid/cpp/src/qpid/cluster/Connection.cpp
+++ b/qpid/cpp/src/qpid/cluster/Connection.cpp
@@ -196,7 +196,7 @@ void Connection::received(framing::AMQFrame& f) {
<< *this << ": " << f);
return;
}
- QPID_LOG(trace, cluster << " RECV " << *this << ": " << f);
+ QPID_LOG_IF(trace, Cluster::loggable(f), cluster << " RECV " << *this << ": " << f);
if (isLocal()) { // Local catch-up connection.
currentChannel = f.getChannel();
if (!framing::invoke(*this, *f.getBody()).wasHandled())
diff --git a/qpid/cpp/src/qpid/cluster/Multicaster.cpp b/qpid/cpp/src/qpid/cluster/Multicaster.cpp
index 8916de9628..217641841c 100644
--- a/qpid/cpp/src/qpid/cluster/Multicaster.cpp
+++ b/qpid/cpp/src/qpid/cluster/Multicaster.cpp
@@ -21,6 +21,7 @@
#include "qpid/cluster/Multicaster.h"
#include "qpid/cluster/Cpg.h"
+#include "qpid/cluster/Cluster.h"
#include "qpid/log/Statement.h"
#include "qpid/framing/AMQBody.h"
#include "qpid/framing/AMQFrame.h"
@@ -58,7 +59,7 @@ void Multicaster::mcast(const Event& e) {
return;
}
}
- QPID_LOG(trace, "MCAST " << e);
+ QPID_LOG_IF(trace, e.isControl() && Cluster::loggable(e.getFrame()), "MCAST " << e);
if (bypass) { // direct, don't queue
iovec iov = e.toIovec();
while (!cpg.mcast(&iov, 1))