summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2013-02-26 20:04:07 +0000
committerAlan Conway <aconway@apache.org>2013-02-26 20:04:07 +0000
commitd86db4f6bd49a1f83c19086d75d09f115f69adea (patch)
tree16156b001defe7cca8a134aa4d5f2bfdea73a252 /qpid/cpp/src
parentbbdd8968d545d05c4a777c93d8f7b52e0aa87f87 (diff)
downloadqpid-python-d86db4f6bd49a1f83c19086d75d09f115f69adea.tar.gz
QPID-4601: HA backup broker shuts down after redeclaring exchange
There was a bug in ExchangeRegistry, it was always setting disp=created even if the exchange was already present. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1450383 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp2
-rwxr-xr-xqpid/cpp/src/tests/ha_tests.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp b/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp
index 46175fd2e4..645918d526 100644
--- a/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp
+++ b/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp
@@ -97,7 +97,7 @@ pair<Exchange::shared_ptr, bool> ExchangeRegistry::declare(
durable,
false,
ManagementAgent::toMap(result.first->getArgs()),
- "created"));
+ result.second ? "created" : "existing"));
}
}
return result;
diff --git a/qpid/cpp/src/tests/ha_tests.py b/qpid/cpp/src/tests/ha_tests.py
index 587a150dda..77399bf2e2 100755
--- a/qpid/cpp/src/tests/ha_tests.py
+++ b/qpid/cpp/src/tests/ha_tests.py
@@ -885,6 +885,21 @@ acl deny all all
cluster[2].wait_address("xx")
self.assertEqual(cluster[2].agent().getExchange("xx").values["bindingCount"], 0)
+ def test_redeclare_exchange(self):
+ """Ensure that re-declaring an exchange is an HA no-op"""
+ cluster = HaCluster(self, 2)
+ ps = cluster[0].connect().session()
+ ps.sender("ex1;{create:always,node:{type:topic,x-declare:{arguments:{'qpid.replicate':all}, type:'fanout'}}}")
+ ps.sender("ex2;{create:always,node:{type:topic,x-declare:{arguments:{'qpid.replicate':all}, type:'fanout', alternate-exchange:'ex1'}}}")
+ cluster[1].wait_backup("ex1")
+ cluster[1].wait_backup("ex2")
+
+ # Use old API to re-declare the exchange
+ old_conn = cluster[0].connect_old()
+ old_sess = old_conn.session(str(qpid.datatypes.uuid4()))
+ old_sess.exchange_declare(exchange='ex1', type='fanout')
+ cluster[1].wait_backup("ex1")
+
def fairshare(msgs, limit, levels):
"""
Generator to return prioritised messages in expected order for a given fairshare limit