summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-09-11 15:35:01 +0000
committerAlan Conway <aconway@apache.org>2012-09-11 15:35:01 +0000
commitfa4485993c1a0c2b691918ddfaa6748fa4b50971 (patch)
treeaab034840aa77f69a04089b8173054dc51ea9869 /cpp/src
parent03fbf27d2f43a039263cf04448951e49d4c21f1c (diff)
downloadqpid-python-fa4485993c1a0c2b691918ddfaa6748fa4b50971.tar.gz
NO-JIRA: Correct bug in ReplicatingSubscription::getNext - find next message *after* position.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1383453 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/ha/QueueReplicator.cpp9
-rw-r--r--cpp/src/qpid/ha/ReplicatingSubscription.cpp4
-rw-r--r--cpp/src/qpid/ha/ReplicatingSubscription.h4
3 files changed, 9 insertions, 8 deletions
diff --git a/cpp/src/qpid/ha/QueueReplicator.cpp b/cpp/src/qpid/ha/QueueReplicator.cpp
index ae53f89404..8baecb0e0f 100644
--- a/cpp/src/qpid/ha/QueueReplicator.cpp
+++ b/cpp/src/qpid/ha/QueueReplicator.cpp
@@ -120,10 +120,10 @@ void QueueReplicator::initializeBridge(Bridge& bridge, SessionHandler& sessionHa
settings.setTable(ReplicatingSubscription::QPID_BROKER_INFO,
brokerInfo.asFieldTable());
SequenceNumber front;
- if (ReplicatingSubscription::getFront(*queue, front)) {
+ if (ReplicatingSubscription::getFront(*queue, front))
settings.setInt(ReplicatingSubscription::QPID_FRONT, front);
- QPID_LOG(debug, "QPID_FRONT for " << queue->getName() << " is " << front);
- }
+ QPID_LOG(debug, logPrefix << " subscribe with settings " << settings);
+
peer.getMessage().subscribe(
args.i_src, args.i_dest, 0/*accept-explicit*/, 1/*not-acquired*/,
false/*exclusive*/, "", 0, settings);
@@ -177,7 +177,8 @@ void QueueReplicator::route(Deliverable& msg)
// Verify that there are no messages after the new position in the queue.
SequenceNumber next;
if (ReplicatingSubscription::getNext(*queue, position, next))
- throw Exception("Invalid position move, preceeds messages");
+ throw Exception(QPID_MSG(logPrefix << "Invalid position " << position
+ << " preceeds message at " << next));
queue->setPosition(position);
}
// Ignore unknown event keys, may be introduced in later versions.
diff --git a/cpp/src/qpid/ha/ReplicatingSubscription.cpp b/cpp/src/qpid/ha/ReplicatingSubscription.cpp
index 6f7519cd1f..4be737e025 100644
--- a/cpp/src/qpid/ha/ReplicatingSubscription.cpp
+++ b/cpp/src/qpid/ha/ReplicatingSubscription.cpp
@@ -99,10 +99,10 @@ bool getSequence(const Message& message, SequenceNumber& result)
}
}
bool ReplicatingSubscription::getNext(
- broker::Queue& q, SequenceNumber from, SequenceNumber& result)
+ broker::Queue& q, SequenceNumber position, SequenceNumber& result)
{
QueueCursor cursor(REPLICATOR);
- return q.seek(cursor, boost::bind(&getSequence, _1, boost::ref(result)), from);
+ return q.seek(cursor, boost::bind(&getSequence, _1, boost::ref(result)), position+1);
}
bool ReplicatingSubscription::getFront(broker::Queue& q, SequenceNumber& front) {
diff --git a/cpp/src/qpid/ha/ReplicatingSubscription.h b/cpp/src/qpid/ha/ReplicatingSubscription.h
index 8a2984846e..c8e2c4f457 100644
--- a/cpp/src/qpid/ha/ReplicatingSubscription.h
+++ b/cpp/src/qpid/ha/ReplicatingSubscription.h
@@ -85,10 +85,10 @@ class ReplicatingSubscription : public broker::SemanticState::ConsumerImpl
*@return false if queue is empty.
*/
static bool getFront(broker::Queue&, framing::SequenceNumber& result);
- /** Get next message after from in queue.
+ /** Get next message after position in queue.
*@return false if none found.
*/
- static bool getNext(broker::Queue&, framing::SequenceNumber from,
+ static bool getNext(broker::Queue&, framing::SequenceNumber position,
framing::SequenceNumber& result);
ReplicatingSubscription(broker::SemanticState* parent,