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 2011/12/15 23:13:25 UTC
svn commit: r1214970 - in /qpid/branches/qpid-3603/qpid/cpp/src/qpid:
broker/SemanticState.h ha/ReplicatingSubscription.cpp
ha/ReplicatingSubscription.h
Author: aconway
Date: Thu Dec 15 22:13:24 2011
New Revision: 1214970
URL: http://svn.apache.org/viewvc?rev=1214970&view=rev
Log:
QPID-3603: Added backup connection identifier to logging output.
Modified:
qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/SemanticState.h
qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp
qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h
Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/SemanticState.h
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/SemanticState.h?rev=1214970&r1=1214969&r2=1214970&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/SemanticState.h (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/SemanticState.h Thu Dec 15 22:13:24 2011
@@ -76,8 +76,8 @@ class SemanticState : private boost::non
{
protected:
mutable qpid::sys::Mutex lock;
- private:
SemanticState* const parent;
+ private:
const boost::shared_ptr<Queue> queue;
const bool ackExpected;
const bool acquire;
Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp?rev=1214970&r1=1214969&r2=1214970&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp Thu Dec 15 22:13:24 2011
@@ -22,9 +22,12 @@
#include "ReplicatingSubscription.h"
#include "Logging.h"
#include "qpid/broker/Queue.h"
+#include "qpid/broker/SessionContext.h"
+#include "qpid/broker/ConnectionState.h"
#include "qpid/framing/AMQFrame.h"
#include "qpid/framing/MessageTransferBody.h"
#include "qpid/log/Statement.h"
+#include "ostream"
namespace qpid {
namespace ha {
@@ -93,7 +96,7 @@ ReplicatingSubscription::ReplicatingSubs
// can be re-introduced later. Last revision with the optimization:
// r1213258 | QPID-3603: Fix QueueReplicator subscription parameters.
- QPID_LOG(debug, "HA: Replicating subscription " << name << " to " << queue->getName());
+ QPID_LOG(debug, "HA: Started " << *this << " subscription " << name);
// Note that broker::Queue::getPosition() returns the sequence
// number that will be assigned to the next message *minus 1*.
@@ -127,13 +130,14 @@ bool ReplicatingSubscription::deliver(Qu
}
backupPosition = position;
}
- QPID_LOG(trace, "HA: replicating message to backup: " << QueuePos(m));
+ QPID_LOG(trace, "HA: Replicating " << QueuePos(m) << " to " << *this);
}
return ConsumerImpl::deliver(m);
}
void ReplicatingSubscription::cancel()
{
+ QPID_LOG(debug, "HA: Cancelled " << *this);
getQueue()->removeObserver(boost::dynamic_pointer_cast<QueueObserver>(shared_from_this()));
}
@@ -150,7 +154,7 @@ void ReplicatingSubscription::enqueued(c
// Called with lock held.
void ReplicatingSubscription::sendDequeueEvent(const sys::Mutex::ScopedLock& l)
{
- QPID_LOG(trace, "HA: Sending dequeues " << getQueue()->getName() << " " << dequeues << " on " << getName());
+ QPID_LOG(trace, "HA: Sending dequeues " << dequeues << " to " << *this);
string buf(dequeues.encodedSize(),'\0');
framing::Buffer buffer(&buf[0], buf.size());
dequeues.encode(buffer);
@@ -164,7 +168,7 @@ void ReplicatingSubscription::sendPositi
SequenceNumber position, const sys::Mutex::ScopedLock&l )
{
QPID_LOG(trace, "HA: Sending position " << QueuePos(getQueue().get(), position)
- << " on " << getName());
+ << " on " << *this);
string buf(backupPosition.encodedSize(),'\0');
framing::Buffer buffer(&buf[0], buf.size());
position.encode(buffer);
@@ -211,12 +215,12 @@ void ReplicatingSubscription::dequeued(c
{
sys::Mutex::ScopedLock l(lock);
dequeues.add(m.position);
- QPID_LOG(trace, "HA: Dequeued " << QueuePos(m) << " on " << getName());
+ QPID_LOG(trace, "HA: Will dequeue " << QueuePos(m) << " on " << *this);
}
notify(); // Ensure a call to doDispatch
if (m.position > position) {
m.payload->getIngressCompletion().finishCompleter();
- QPID_LOG(trace, "HA: Completed " << QueuePos(m) << " early, dequeued.");
+ QPID_LOG(trace, "HA: Completed " << QueuePos(m) << " early on " << *this);
}
}
@@ -240,4 +244,10 @@ bool ReplicatingSubscription::Delegating
bool ReplicatingSubscription::DelegatingConsumer::accept(boost::intrusive_ptr<Message> msg) { return delegate.accept(msg); }
OwnershipToken* ReplicatingSubscription::DelegatingConsumer::getSession() { return delegate.getSession(); }
-}} // namespace qpid::broker
+
+ostream& operator<<(ostream& o, const ReplicatingSubscription& rs) {
+ string url = rs.parent->getSession().getConnection().getUrl();
+ return o << rs.getQueue()->getName() << " backup on " << url;
+}
+
+}} // namespace qpid::ha
Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h?rev=1214970&r1=1214969&r2=1214970&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h Thu Dec 15 22:13:24 2011
@@ -26,6 +26,7 @@
#include "qpid/broker/SemanticState.h"
#include "qpid/broker/QueueObserver.h"
#include "qpid/broker/ConsumerFactory.h"
+#include <iosfwd>
namespace qpid {
@@ -109,6 +110,9 @@ class ReplicatingSubscription : public b
private:
ReplicatingSubscription& delegate;
};
+
+ /** Print a identifier for a ReplicatingSubscription */
+ friend std::ostream& operator<<(std::ostream&, const ReplicatingSubscription&);
};
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org