From cbc1284b92c4598409cb671a668ce9a6deae8fc3 Mon Sep 17 00:00:00 2001 From: "Carl C. Trieloff" Date: Tue, 7 Jul 2009 01:53:13 +0000 Subject: Corrected the case where message on more than one queue does not persist when last node standing is enabled git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@791672 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/Message.cpp | 10 +++++++++- cpp/src/qpid/broker/Message.h | 1 + cpp/src/qpid/broker/Queue.cpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'cpp/src/qpid') diff --git a/cpp/src/qpid/broker/Message.cpp b/cpp/src/qpid/broker/Message.cpp index 6aeb9e47f9..2c3c444baa 100644 --- a/cpp/src/qpid/broker/Message.cpp +++ b/cpp/src/qpid/broker/Message.cpp @@ -59,7 +59,15 @@ Message::~Message() void Message::forcePersistent() { - forcePersistentPolicy = true; + // only set forced bit if we actually need to force. + if (! getAdapter().isPersistent(frames) ){ + forcePersistentPolicy = true; + } +} + +bool Message::isForcedPersistent() +{ + return forcePersistentPolicy; } std::string Message::getRoutingKey() const diff --git a/cpp/src/qpid/broker/Message.h b/cpp/src/qpid/broker/Message.h index cd2513284a..94ce7561a7 100644 --- a/cpp/src/qpid/broker/Message.h +++ b/cpp/src/qpid/broker/Message.h @@ -147,6 +147,7 @@ public: void addTraceId(const std::string& id); void forcePersistent(); + bool isForcedPersistent(); boost::intrusive_ptr& getReplacementMessage(const Queue* qfor) const; void setReplacementMessage(boost::intrusive_ptr msg, const Queue* qfor); diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index 64efc93a22..30b33d877b 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -668,7 +668,7 @@ void Queue::setLastNodeFailure() for ( Messages::iterator i = messages.begin(); i != messages.end(); ++i ) { if (lastValueQueue) checkLvqReplace(*i); i->payload->forcePersistent(); - if (i->payload->getPersistenceId() == 0){ + if (i->payload->isForcedPersistent() ){ enqueue(0, i->payload); } } -- cgit v1.2.1