diff options
author | Alan Conway <aconway@apache.org> | 2013-10-25 18:13:35 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2013-10-25 18:13:35 +0000 |
commit | cafc3478000e381db390bcd97615518cd1f02d00 (patch) | |
tree | b3d5285f1cabff50492a3af2ee4b67d83dcd02f4 /qpid/cpp/src/qpid/broker/Queue.h | |
parent | de782d5e01159cb6a3283e917d47cab70c9730f9 (diff) | |
download | qpid-python-cafc3478000e381db390bcd97615518cd1f02d00.tar.gz |
QPID-4287: Poor performance when a priority queue with a ring queue policy has a large backlog
LossyQueue::checkDepth was performing an unintended linear search of its
messages when a new message was added at capacity. Since the messages are in
priority order, only the tail message on the queue needs to be compared with the
new message to determine which of them should be dropped.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1535803 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/broker/Queue.h')
-rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/broker/Queue.h b/qpid/cpp/src/qpid/broker/Queue.h index a7eb71c6bb..3622b06dbd 100644 --- a/qpid/cpp/src/qpid/broker/Queue.h +++ b/qpid/cpp/src/qpid/broker/Queue.h @@ -255,7 +255,22 @@ class Queue : public boost::enable_shared_from_this<Queue>, void abandoned(const Message& message); bool checkNotDeleted(const Consumer::shared_ptr&); void notifyDeleted(); - uint32_t remove(uint32_t maxCount, MessagePredicate, MessageFunctor, SubscriptionType, bool triggerAutoDelete); + + /** Remove messages from the queue: + *@param maxCount Maximum number of messages to remove, 0 means unlimited. + *@param p Only remove messages for which p(msg) is true. + *@param f Call f on each message that is removed. + *@param st Use a cursor of this SubscriptionType to iterate messages to remove. + *@param triggerAutoDelete If true removing messages may trigger aut-delete. + *@param maxTests Max number of messages to test for removal, 0 means unlimited. + *@return Number of messages removed. + */ + uint32_t remove(uint32_t maxCount, + MessagePredicate p, MessageFunctor f, + SubscriptionType st, + bool triggerAutoDelete, + uint32_t maxTests=0); + virtual bool checkDepth(const QueueDepth& increment, const Message&); void tryAutoDelete(); public: |