summaryrefslogtreecommitdiff
path: root/cpp/src/qpid
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2010-04-28 17:26:16 +0000
committerKim van der Riet <kpvdr@apache.org>2010-04-28 17:26:16 +0000
commit20178b8bbc5b55d982848eac660e0704f6f80d5b (patch)
treeef746dabcf7f4ccd8af9b2360d8aa83dff816db1 /cpp/src/qpid
parent7bbfd9565918d0fa2d537d4fca68aab371f3f9cf (diff)
downloadqpid-python-20178b8bbc5b55d982848eac660e0704f6f80d5b.tar.gz
BZ572245: Clustering can force message persistence when one node remains. Fix for problem in which forcing persistence on one queue but not another results in an error if a message is sent to both and the message is consumed from the non-forced queue.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@939014 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
-rw-r--r--cpp/src/qpid/broker/Queue.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp
index 3b7461e094..417aaddb4a 100644
--- a/cpp/src/qpid/broker/Queue.cpp
+++ b/cpp/src/qpid/broker/Queue.cpp
@@ -771,11 +771,16 @@ bool Queue::dequeue(TransactionContext* ctxt, const QueuedMessage& msg)
dequeued(msg);
}
}
- if ((msg.payload->isPersistent() || msg.payload->checkContentReleasable()) && store) {
- msg.payload->dequeueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue
- boost::intrusive_ptr<PersistableMessage> pmsg = boost::static_pointer_cast<PersistableMessage>(msg.payload);
- store->dequeue(ctxt, pmsg, *this);
- return true;
+ // This check prevents messages which have been forced persistent on one queue from dequeuing
+ // from another on which no forcing has taken place and thus causing a store error.
+ bool fp = msg.payload->isForcedPersistent();
+ if (!fp || (fp && msg.payload->isStoredOnQueue(shared_from_this()))) {
+ if ((msg.payload->isPersistent() || msg.payload->checkContentReleasable()) && store) {
+ msg.payload->dequeueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue
+ boost::intrusive_ptr<PersistableMessage> pmsg = boost::static_pointer_cast<PersistableMessage>(msg.payload);
+ store->dequeue(ctxt, pmsg, *this);
+ return true;
+ }
}
return false;
}