diff options
author | Alan Conway <aconway@apache.org> | 2012-09-19 21:42:21 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-09-19 21:42:21 +0000 |
commit | 653f560b36eb7070303eabc0aad0e0ab5fe47f8f (patch) | |
tree | 66c570fe1663016cda22ccb40da00a6ac28c8cb0 /cpp/src/qpid/broker/Queue.cpp | |
parent | a770b917bad25a996b2177f83ca9c38df7161edf (diff) | |
download | qpid-python-653f560b36eb7070303eabc0aad0e0ab5fe47f8f.tar.gz |
QPID-4322: HA sporadic failure in ha_tests
Added Queue::getRange to get range atomically, fixes races around getting
the front and backup of the range as two separate operations.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1387785 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/Queue.cpp')
-rw-r--r-- | cpp/src/qpid/broker/Queue.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index 9be3a1acac..276e17a8b5 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -1390,6 +1390,16 @@ SequenceNumber Queue::getPosition() { return sequence; } +void Queue::getRange(framing::SequenceNumber& front, framing::SequenceNumber& back, + SubscriptionType type) +{ + Mutex::ScopedLock locker(messageLock); + QueueCursor cursor(type); + back = sequence; + Message* message = messages->next(cursor); + front = message ? message->getSequence() : back+1; +} + int Queue::getEventMode() { return eventMode; } void Queue::recoveryComplete(ExchangeRegistry& exchanges) |