Author: aconway Date: Tue Feb 26 20:04:07 2013 New Revision: 1450383 URL: http://svn.apache.org/r1450383 Log: 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. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp qpid/trunk/qpid/cpp/src/tests/ha_tests.py Modified: qpid/trunk/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp?rev=1450383&r1=1450382&r2=1450383&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp Tue Feb 26 20:04:07 2013 @@ -97,7 +97,7 @@ pair<Exchange::shared_ptr, bool> Exchang durable, false, ManagementAgent::toMap(result.first->getArgs()), - "created")); + result.second ? "created" : "existing")); } } return result; Modified: qpid/trunk/qpid/cpp/src/tests/ha_tests.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/ha_tests.py?rev=1450383&r1=1450382&r2=1450383&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/tests/ha_tests.py (original) +++ qpid/trunk/qpid/cpp/src/tests/ha_tests.py Tue Feb 26 20:04:07 2013 @@ -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 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org