diff options
author | Alan Conway <aconway@apache.org> | 2009-10-05 18:09:34 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-10-05 18:09:34 +0000 |
commit | 873e2d1ea874d98000de259cc579530cb7e66d9c (patch) | |
tree | 08e90848c78d121d09aa8749dacaed0b2877a046 /cpp/src | |
parent | c411741206b954ad8de24833c5d066d53f9dc69a (diff) | |
download | qpid-python-873e2d1ea874d98000de259cc579530cb7e66d9c.tar.gz |
Minor improvements to cluster logging.
Include the original error message in critical log messages.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@821948 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/cluster/ErrorCheck.cpp | 30 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/ErrorCheck.h | 1 | ||||
-rw-r--r-- | cpp/src/tests/PartialFailure.cpp | 6 |
3 files changed, 21 insertions, 16 deletions
diff --git a/cpp/src/qpid/cluster/ErrorCheck.cpp b/cpp/src/qpid/cluster/ErrorCheck.cpp index 35be055d06..5b7011047b 100644 --- a/cpp/src/qpid/cluster/ErrorCheck.cpp +++ b/cpp/src/qpid/cluster/ErrorCheck.cpp @@ -45,7 +45,8 @@ ostream& operator<<(ostream& o, const ErrorCheck::MemberSet& ms) { } void ErrorCheck::error( - Connection& c, ErrorType t, framing::SequenceNumber seq, const MemberSet& ms, const std::string& msg) + Connection& c, ErrorType t, framing::SequenceNumber seq, const MemberSet& ms, + const std::string& msg) { // Detected a local error, inform cluster and set error state. assert(t != ERROR_TYPE_NONE); // Must be an error. @@ -54,10 +55,11 @@ void ErrorCheck::error( unresolved = ms; frameSeq = seq; connection = &c; - QPID_LOG(error, cluster - << (type == ERROR_TYPE_SESSION ? " channel" : " connection") - << " error " << frameSeq << " on " << c << ": " << msg - << " must be resolved with: " << unresolved); + message = msg; + QPID_LOG(debug, cluster<< (type == ERROR_TYPE_SESSION ? " channel" : " connection") + << " error " << frameSeq << " on " << c + << " must be resolved with: " << unresolved + << ": " << message); mcast.mcastControl( ClusterErrorCheckBody(ProtocolVersion(), type, frameSeq), cluster.getId()); // If there are already frames queued up by a previous error, review @@ -84,13 +86,15 @@ ErrorCheck::FrameQueue::iterator ErrorCheck::review(const FrameQueue::iterator& if (errorCheck->getFrameSeq() == frameSeq) { // Addresses current error next = frames.erase(i); // Drop matching error check controls if (errorCheck->getType() < type) { // my error is worse than his - QPID_LOG(critical, cluster << " error " << frameSeq - << " did not occur on " << i->getMemberId()); - throw Exception(QPID_MSG("Error " << frameSeq - << " did not occur on all members")); + QPID_LOG(critical, cluster + << " local error " << frameSeq << " did not occur on member " + << i->getMemberId() + << ": " << message); + throw Exception( + QPID_MSG("local error did not occur on all cluster members " << ": " << message)); } else { // his error is worse/same as mine. - QPID_LOG(info, cluster << " error " << frameSeq + QPID_LOG(debug, cluster << " error " << frameSeq << " resolved with " << i->getMemberId()); unresolved.erase(i->getMemberId()); checkResolved(); @@ -128,10 +132,10 @@ ErrorCheck::FrameQueue::iterator ErrorCheck::review(const FrameQueue::iterator& void ErrorCheck::checkResolved() { if (unresolved.empty()) { // No more potentially conflicted members, we're clear. type = ERROR_TYPE_NONE; - QPID_LOG(info, cluster << " error " << frameSeq << " resolved."); + QPID_LOG(debug, cluster << " error " << frameSeq << " resolved."); } else - QPID_LOG(info, cluster << " error " << frameSeq + QPID_LOG(debug, cluster << " error " << frameSeq << " must be resolved with " << unresolved); } @@ -146,7 +150,7 @@ void ErrorCheck::respondNone(const MemberId& from, uint8_t type, framing::Sequen // Don't respond to non-errors or to my own errors. if (type == ERROR_TYPE_NONE || from == cluster.getId()) return; - QPID_LOG(info, cluster << " error " << frameSeq << " did not occur locally."); + QPID_LOG(debug, cluster << " error " << frameSeq << " did not occur locally."); mcast.mcastControl( ClusterErrorCheckBody(ProtocolVersion(), ERROR_TYPE_NONE, frameSeq), cluster.getId() diff --git a/cpp/src/qpid/cluster/ErrorCheck.h b/cpp/src/qpid/cluster/ErrorCheck.h index 09028391ac..c975b9af64 100644 --- a/cpp/src/qpid/cluster/ErrorCheck.h +++ b/cpp/src/qpid/cluster/ErrorCheck.h @@ -84,6 +84,7 @@ class ErrorCheck SequenceNumber frameSeq; ErrorType type; Connection* connection; + std::string message; }; }} // namespace qpid::cluster diff --git a/cpp/src/tests/PartialFailure.cpp b/cpp/src/tests/PartialFailure.cpp index 5de8ecb189..08c326cd02 100644 --- a/cpp/src/tests/PartialFailure.cpp +++ b/cpp/src/tests/PartialFailure.cpp @@ -93,7 +93,7 @@ QPID_AUTO_TEST_CASE(testCoincidentErrors) { c0.session.queueDeclare("q", durable=true); { - ScopedSuppressLogging allQuiet; + // ScopedSuppressLogging allQuiet; async(c0.session).messageTransfer(content=pMessage("TEST_STORE_DO: s0[exception]", "q")); async(c1.session).messageTransfer(content=pMessage("TEST_STORE_DO: s1[exception]", "q")); @@ -118,7 +118,7 @@ QPID_AUTO_TEST_CASE(testNormalErrors) { Client c2(cluster[2], "c2"); { - ScopedSuppressLogging allQuiet; + // ScopedSuppressLogging allQuiet; queueAndSub(c0); c0.session.messageTransfer(content=Message("x", "c0")); BOOST_CHECK_EQUAL(c0.lq.get(TIMEOUT).getData(), "x"); @@ -147,7 +147,7 @@ QPID_AUTO_TEST_CASE(testErrorAfterJoin) { ClusterFixture cluster(1, updateArgs, -1); Client c0(cluster[0]); { - ScopedSuppressLogging allQuiet; + // ScopedSuppressLogging allQuiet; c0.session.queueDeclare("q", durable=true); c0.session.messageTransfer(content=pMessage("a", "q")); |