diff options
author | Carl C. Trieloff <cctrieloff@apache.org> | 2009-07-08 18:58:27 +0000 |
---|---|---|
committer | Carl C. Trieloff <cctrieloff@apache.org> | 2009-07-08 18:58:27 +0000 |
commit | 7c771eec9869c897b4b41caf1aa4e5978242c13d (patch) | |
tree | 664708a705954e1e87a60f0a22dc9176506e0cae /cpp/src/tests/QueueTest.cpp | |
parent | 9f3da3d3eb5e45adaaa619df03dba8ffc3c7ae5e (diff) | |
download | qpid-python-7c771eec9869c897b4b41caf1aa4e5978242c13d.tar.gz |
fix for regression in patch & test to prevent regression again
Simulate this:
1. start 2 nodes
2. create cluster durable lvq
3. send a transient message to the queue
4. kill one of the nodes (to trigger force persistent behaviour)...
5. then restart it (to turn off force persistent behaviour)
6. send another transient message with same lvq key as in 3
7. kill the second node again (retrigger force persistent)
8. stop and recover the first node
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@792259 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/QueueTest.cpp')
-rw-r--r-- | cpp/src/tests/QueueTest.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cpp/src/tests/QueueTest.cpp b/cpp/src/tests/QueueTest.cpp index 5aad3da7dd..1d4ba968e5 100644 --- a/cpp/src/tests/QueueTest.cpp +++ b/cpp/src/tests/QueueTest.cpp @@ -488,6 +488,53 @@ QPID_AUTO_TEST_CASE(testLVQMultiQueue){ } +QPID_AUTO_TEST_CASE(testLVQRecover){ + +/* simulate this + 1. start 2 nodes + 2. create cluster durable lvq + 3. send a transient message to the queue + 4. kill one of the nodes (to trigger force persistent behaviour)... + 5. then restart it (to turn off force persistent behaviour) + 6. send another transient message with same lvq key as in 3 + 7. kill the second node again (retrigger force persistent) + 8. stop and recover the first node +*/ + TestMessageStoreOC testStore; + client::QueueOptions args; + // set queue mode + args.setOrdering(client::LVQ); + args.setPersistLastNode(); + + Queue::shared_ptr queue1(new Queue("my-queue", true, &testStore)); + intrusive_ptr<Message> received; + queue1->configure(args); + + intrusive_ptr<Message> msg1 = create_message("e", "A"); + intrusive_ptr<Message> msg2 = create_message("e", "A"); + // 2 + string key; + args.getLVQKey(key); + BOOST_CHECK_EQUAL(key, "qpid.LVQ_key"); + + msg1->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a"); + msg2->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a"); + // 3 + queue1->deliver(msg1); + // 4 + queue1->setLastNodeFailure(); + BOOST_CHECK_EQUAL(testStore.enqCnt, 1u); + // 5 + queue1->clearLastNodeFailure(); + BOOST_CHECK_EQUAL(testStore.enqCnt, 1u); + // 6 + queue1->deliver(msg2); + BOOST_CHECK_EQUAL(testStore.enqCnt, 1u); + queue1->setLastNodeFailure(); + BOOST_CHECK_EQUAL(testStore.enqCnt, 2u); + BOOST_CHECK_EQUAL(testStore.deqCnt, 1u); +} + void addMessagesToQueue(uint count, Queue& queue, uint oddTtl = 200, uint evenTtl = 0) { for (uint i = 0; i < count; i++) { @@ -594,6 +641,9 @@ QPID_AUTO_TEST_CASE(testMultiQueueLastNode){ queue2->setLastNodeFailure(); BOOST_CHECK_EQUAL(testStore.enqCnt, 8u); + queue2->clearLastNodeFailure(); + queue2->setLastNodeFailure(); + BOOST_CHECK_EQUAL(testStore.enqCnt, 8u); } |