Bug 441700 - Add a 'ring' queue
Summary: Add a 'ring' queue
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-cpp
Version: 1.0
Hardware: All
OS: Linux
high
low
Target Milestone: 1.1
: ---
Assignee: Gordon Sim
QA Contact: Kim van der Riet
URL:
Whiteboard:
Depends On:
Blocks: 471300
TreeView+ depends on / blocked
 
Reported: 2008-04-09 15:31 UTC by Gordon Sim
Modified: 2009-02-04 15:36 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-02-04 15:36:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2009:0035 0 normal SHIPPED_LIVE Red Hat Enterprise MRG Messaging 1.1 Release 2009-02-04 15:33:44 UTC

Description Gordon Sim 2008-04-09 15:31:48 UTC
The core feature would be to have a fixed size queue (fixed in the number of
unacked messages). Once this limit was reached, new publications would result in
the oldest message being dropped.

In addition a further option would prevent the replacement of oldest by newest
message when a client was processing the messages. Publication would fail in
this state.

Comment 1 Gordon Sim 2008-04-09 15:33:21 UTC
The objective of the second option above is to prevent 'gaps' appearing in the
sequence seen by the consuming client.

Comment 2 Sergei Vorobiev 2008-06-19 14:28:45 UTC
otherwise the ring queue is expected to have the same basic features as a
regular queue (such as acquire modes, transactional delivery, ability to
cluster, transient vs durable, etc)

Comment 3 Gordon Sim 2008-09-30 14:44:16 UTC
There are two 'policy types' through which these features are delivered, these and the desired limits, are passed as name-value pairs in the arguments parameter to the queue.declare command used to create the queue.

qpid.policy_type=ring will cause the queue to delete the oldest message when an enqueue would otherwise breach the configured queue limit.

qpid.policy_type=ring_strict does the same, but if the oldest message has been delivered to a client but not yet acknowledged, it will not be removed to make way for new messages and the attempted enqueue will result in a failure.

The limit is set through either qpid.max_size (the total size of all messages on the queue) or qpid.max_count (the number of messages on the queue).

The functionality is covered by the QueuePolicyTests suite in Qpid, particularly the testRingPolicy and testStrictRingPolicy test cases. 

Test strategy: 

Case 1:
1.1. configure a queue with qpid.policy_type=ring, qpid.count=5
1.2. publish 10 distinct messages
1.3. read the messages from the queue and verify that only the last five were delivered

Case 2:

As for case 1, but using qpid.policy_type=ring_strict in step 1

Case 3:

1. configure a queue with qpid.policy_type=ring_strict, qpid.count=5
2. publish 5 messages
3. subscribe to queue and receive but do not ack all 5 messages
4. attempt to publish a further message which should fail

Case 4:

1. configure a queue with qpid.policy_type=ring_strict, qpid.count=5
2. publish 5 messages
3. subscribe to queue and receive but do not ack all 5 messages
4. attempt to publish a further message which should succeed
5. ack all messages

Comment 5 David Sommerseth 2008-12-16 12:53:33 UTC
Wrote test program in Python (cvs:/cvs/dist/tests/distribution/MRG_Messaging/qpid_test_ring_queue_bz441700/)

Test result show that ring queues are implemented according to expectations comment#3 ... One remark regarding test case 4 (D), the description is wrong - the policy type should be 'ring' and not 'ring_strict'.  This is checked with Gordon.

Test result:

$ ./bz441700.py
----> TEST-A - Policy: ring  -  Ring size: 5  - Using queue name: ringq_testA_ring_5
        Sending: ring test A ... message 1/10
        Sending: ring test A ... message 2/10
        Sending: ring test A ... message 3/10
        Sending: ring test A ... message 4/10
        Sending: ring test A ... message 5/10
        Sending: ring test A ... message 6/10
        Sending: ring test A ... message 7/10
        Sending: ring test A ... message 8/10
        Sending: ring test A ... message 9/10
        Sending: ring test A ... message 10/10
        Received: ring test A ... message 6/10
        Received: ring test A ... message 7/10
        Received: ring test A ... message 8/10
        Received: ring test A ... message 9/10
        Received: ring test A ... message 10/10
        Message queue is empty
        Got the expected number of messages
====> TEST-A - PASS

----> TEST-B - Policy: ring_strict  -  Ring size: 5  - Using queue name: ringq_testB_ring_strict_5
        Sending: ring test B ... message 1/10
        Sending: ring test B ... message 2/10
        Sending: ring test B ... message 3/10
        Sending: ring test B ... message 4/10
        Sending: ring test B ... message 5/10
        Sending: ring test B ... message 6/10
        Sending: ring test B ... message 7/10
        Sending: ring test B ... message 8/10
        Sending: ring test B ... message 9/10
        Sending: ring test B ... message 10/10
        Received: ring test B ... message 6/10
        Received: ring test B ... message 7/10
        Received: ring test B ... message 8/10
        Received: ring test B ... message 9/10
        Received: ring test B ... message 10/10
        Message queue is empty
        Got the expected number of messages
====> TEST-B - PASS

----> TEST-C - Policy: ring_strict  -  Ring size: 5  - Using queue name: ringq_testC_ring_strict_5
        Sending: ring test C.1 ... message 1/5
        Sending: ring test C.1 ... message 2/5
        Sending: ring test C.1 ... message 3/5
        Sending: ring test C.1 ... message 4/5
        Sending: ring test C.1 ... message 5/5
----> Receiving 5 messages, acking 2
        Received: ring test C.1 ... message 1/5
        ** Message acked
        Received: ring test C.1 ... message 2/5
        ** Message acked
        Received: ring test C.1 ... message 3/5
        Received: ring test C.1 ... message 4/5
        Received: ring test C.1 ... message 5/5
        Message queue is empty
        Got the expected number of messages
----> Sending 5 new messages
        Sending: ring test C.2 ... message 1/5
        Sending: ring test C.2 ... message 2/5
        Sending: ring test C.2 ... message 3/5
ERROR:  Could not send messages
====> Sending 5 new messages, failed as expected -- TEST-C PASS

----> TEST-D - Policy: ring  -  Ring size: 5  - Using queue name: ringq_testD_ring_5
        Sending: ring test D.1 ... message 1/5
        Sending: ring test D.1 ... message 2/5
        Sending: ring test D.1 ... message 3/5
        Sending: ring test D.1 ... message 4/5
        Sending: ring test D.1 ... message 5/5
----> Receiving 5 messages, acking 2
        Received: ring test D.1 ... message 1/5
        ** Message acked
        Received: ring test D.1 ... message 2/5
        ** Message acked
        Received: ring test D.1 ... message 3/5
        Received: ring test D.1 ... message 4/5
        Received: ring test D.1 ... message 5/5
        Message queue is empty
        Got the expected number of messages
----> Sending 5 new messages
        Sending: ring test D.2 ... message 1/5
        Sending: ring test D.2 ... message 2/5
        Sending: ring test D.2 ... message 3/5
        Sending: ring test D.2 ... message 4/5
        Sending: ring test D.2 ... message 5/5
====> Sent 5 messages - TEST-D PASS


SUMMARY:
        Score: 0 (0 = no errors)
        Overall result: PASS

Comment 7 errata-xmlrpc 2009-02-04 15:36:07 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-0035.html


Note You need to log in before you can comment on or make changes to this bug.