From 20178b8bbc5b55d982848eac660e0704f6f80d5b Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Wed, 28 Apr 2010 17:26:16 +0000 Subject: 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 --- cpp/src/qpid/broker/Queue.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cpp/src/qpid') 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 pmsg = boost::static_pointer_cast(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 pmsg = boost::static_pointer_cast(msg.payload); + store->dequeue(ctxt, pmsg, *this); + return true; + } } return false; } -- cgit v1.2.1