summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
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
commitf5a811d119243f6ac31889c5b20d82554366d1e0 (patch)
tree846eb22e431966f9f9986fadf9ebe99820ba7f54 /qpid/cpp/src
parent5238bc210e05524356d95c82cb3a6f84fd626049 (diff)
downloadqpid-python-f5a811d119243f6ac31889c5b20d82554366d1e0.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@939014 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/broker/Queue.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp
index 3b7461e094..417aaddb4a 100644
--- a/qpid/cpp/src/qpid/broker/Queue.cpp
+++ b/qpid/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;
}