diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/cluster/Cluster.cpp | 13 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/Cluster.h | 4 | ||||
-rw-r--r-- | cpp/src/qpid/management/ManagementAgent.cpp | 10 | ||||
-rw-r--r-- | cpp/src/qpid/management/ManagementAgent.h | 2 |
4 files changed, 14 insertions, 15 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index 9da183a14d..08819542c2 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -673,15 +673,13 @@ struct AppendQueue { // Log a snapshot of broker state, used for debugging inconsistency problems. // May only be called in deliver thread. -void Cluster::debugSnapshot(const char* prefix, Connection* connection) { +std::string Cluster::debugSnapshot() { assertClusterSafe(); std::ostringstream msg; - msg << prefix; - if (connection) msg << " " << connection->getId(); - msg << " snapshot " << map.getFrameSeq() << ":"; + msg << "queue snapshot at " << map.getFrameSeq() << ":"; AppendQueue append(msg); broker.getQueues().eachQueue(append); - QPID_LOG(trace, msg.str()); + return msg.str(); } // Called from Broker::~Broker when broker is shut down. At this @@ -767,8 +765,9 @@ void Cluster::updateOffer(const MemberId& updater, uint64_t updateeInt, Lock& l) deliverEventQueue.start(); // Not involved in update. } if (updatee != self && url) { - debugSnapshot("join"); + QPID_LOG(debug, debugSnapshot()); if (mAgent) mAgent->clusterUpdate(); + // Updatee will call clusterUpdate when update completes } } @@ -841,7 +840,7 @@ void Cluster::checkUpdateIn(Lock& l) { if (mAgent) mAgent->suppress(false); // Enable management output. discarding = false; // ok to set, we're stalled for update. QPID_LOG(notice, *this << " update complete, starting catch-up."); - debugSnapshot("initial"); + QPID_LOG(debug, debugSnapshot()); if (mAgent) mAgent->clusterUpdate(); deliverEventQueue.start(); } diff --git a/cpp/src/qpid/cluster/Cluster.h b/cpp/src/qpid/cluster/Cluster.h index ffb870606a..3b12f43d54 100644 --- a/cpp/src/qpid/cluster/Cluster.h +++ b/cpp/src/qpid/cluster/Cluster.h @@ -120,8 +120,8 @@ class Cluster : private Cpg::Handler, public management::Manageable { bool isElder() const; - // For debugging only. Can only be called in deliver thread. - void debugSnapshot(const char*, Connection* =0); + // Generates a log message for debugging purposes. + std::string debugSnapshot(); private: typedef sys::Monitor::ScopedLock Lock; diff --git a/cpp/src/qpid/management/ManagementAgent.cpp b/cpp/src/qpid/management/ManagementAgent.cpp index 6263651a98..e4a3bd343f 100644 --- a/cpp/src/qpid/management/ManagementAgent.cpp +++ b/cpp/src/qpid/management/ManagementAgent.cpp @@ -295,7 +295,7 @@ void ManagementAgent::clusterUpdate() { // Set clientWasAdded so that on the next periodicProcessing we will do // a full update on all cluster members. clientWasAdded = true; - debugSnapshot("update"); + QPID_LOG(debug, "cluster update " << debugSnapshot()); } void ManagementAgent::encodeHeader (Buffer& buf, uint8_t opcode, uint32_t seq) @@ -525,7 +525,7 @@ void ManagementAgent::periodicProcessing (void) sendBuffer (msgBuffer, contentSize, mExchange, routingKey); QPID_LOG(trace, "SEND HeartbeatInd to=" << routingKey); } - debugSnapshot("periodic"); + QPID_LOG(debug, "periodic update " << debugSnapshot()); } void ManagementAgent::deleteObjectNowLH(const ObjectId& oid) @@ -1506,14 +1506,14 @@ void ManagementAgent::importAgents(qpid::framing::Buffer& inBuf) { } } -void ManagementAgent::debugSnapshot(const char* type) { +std::string ManagementAgent::debugSnapshot() { std::ostringstream msg; - msg << type << " snapshot, agents:"; + msg << " management snapshot:"; for (RemoteAgentMap::const_iterator i=remoteAgents.begin(); i != remoteAgents.end(); ++i) msg << " " << i->second->routingKey; msg << " packages: " << packages.size(); msg << " objects: " << managementObjects.size(); msg << " new objects: " << newManagementObjects.size(); - QPID_LOG(trace, msg.str()); + return msg.str(); } diff --git a/cpp/src/qpid/management/ManagementAgent.h b/cpp/src/qpid/management/ManagementAgent.h index 3e00ebeb81..cea6cc66bc 100644 --- a/cpp/src/qpid/management/ManagementAgent.h +++ b/cpp/src/qpid/management/ManagementAgent.h @@ -306,7 +306,7 @@ private: size_t validateTableSchema(framing::Buffer&); size_t validateEventSchema(framing::Buffer&); ManagementObjectMap::iterator numericFind(const ObjectId& oid); - void debugSnapshot(const char*); + std::string debugSnapshot(); }; }} |