summaryrefslogtreecommitdiff
path: root/qpid
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-02-02 15:47:41 +0000
committerAlan Conway <aconway@apache.org>2010-02-02 15:47:41 +0000
commit519072ddea713ad7a3a8dd2acb5962c099976d94 (patch)
treec9b76cffdc0fbc1cd129baf1ac0be50c784b31d4 /qpid
parent8e6ba25e1b0c4c69080fa5b314734dbc046a2217 (diff)
downloadqpid-python-519072ddea713ad7a3a8dd2acb5962c099976d94.tar.gz
Cluster: fix update of failover exchange.
During update the cluster was sending an extra update to the failover exchange. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@905676 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
-rw-r--r--qpid/cpp/src/qpid/cluster/Cluster.cpp6
-rw-r--r--qpid/cpp/src/qpid/cluster/FailoverExchange.cpp6
-rw-r--r--qpid/cpp/src/qpid/cluster/FailoverExchange.h5
-rw-r--r--qpid/cpp/src/tests/cluster_test.cpp2
4 files changed, 13 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/cluster/Cluster.cpp b/qpid/cpp/src/qpid/cluster/Cluster.cpp
index 3a6c902d29..8eda6c1949 100644
--- a/qpid/cpp/src/qpid/cluster/Cluster.cpp
+++ b/qpid/cpp/src/qpid/cluster/Cluster.cpp
@@ -826,7 +826,7 @@ void Cluster::checkUpdateIn(Lock& l) {
if (state != UPDATEE) return; // Wait till we reach the stall point.
if (updatedMap) { // We're up to date
map = *updatedMap;
- memberUpdate(l);
+ failoverExchange->setUrls(getUrls(l));
mcast.mcastControl(ClusterReadyBody(ProtocolVersion(), myUrl.str()), self);
state = CATCHUP;
broker.setClusterUpdatee(false);
@@ -908,9 +908,9 @@ void Cluster::memberUpdate(Lock& l) {
std::vector<Url> urls = getUrls(l);
std::vector<string> ids = getIds(l);
size_t size = urls.size();
- failoverExchange->setUrls(urls);
+ failoverExchange->updateUrls(urls);
- if (size == 1 && lastSize > 1 && state >= CATCHUP) {
+ if (size == 1 && lastSize > 1 && state >= CATCHUP) {
QPID_LOG(notice, *this << " last broker standing, update queue policies");
lastBroker = true;
broker.getQueues().updateQueueClusterState(true);
diff --git a/qpid/cpp/src/qpid/cluster/FailoverExchange.cpp b/qpid/cpp/src/qpid/cluster/FailoverExchange.cpp
index e01c41494b..24518dbe9f 100644
--- a/qpid/cpp/src/qpid/cluster/FailoverExchange.cpp
+++ b/qpid/cpp/src/qpid/cluster/FailoverExchange.cpp
@@ -45,9 +45,13 @@ FailoverExchange::FailoverExchange(management::Manageable* parent) : Exchange(TY
mgmtExchange->set_type(TYPE_NAME);
}
-
void FailoverExchange::setUrls(const vector<Url>& u) {
Lock l(lock);
+ urls = u;
+}
+
+void FailoverExchange::updateUrls(const vector<Url>& u) {
+ Lock l(lock);
urls=u;
if (urls.empty()) return;
std::for_each(queues.begin(), queues.end(),
diff --git a/qpid/cpp/src/qpid/cluster/FailoverExchange.h b/qpid/cpp/src/qpid/cluster/FailoverExchange.h
index 738cd2a602..7eb9ea8c3a 100644
--- a/qpid/cpp/src/qpid/cluster/FailoverExchange.h
+++ b/qpid/cpp/src/qpid/cluster/FailoverExchange.h
@@ -41,8 +41,11 @@ class FailoverExchange : public broker::Exchange
static const std::string TYPE_NAME;
FailoverExchange(management::Manageable* parent);
-
+
+ /** Set the URLs but don't send an update.*/
void setUrls(const std::vector<Url>&);
+ /** Set the URLs and send an update.*/
+ void updateUrls(const std::vector<Url>&);
// Exchange overrides
std::string getType() const;
diff --git a/qpid/cpp/src/tests/cluster_test.cpp b/qpid/cpp/src/tests/cluster_test.cpp
index bb1c014b99..d572126fff 100644
--- a/qpid/cpp/src/tests/cluster_test.cpp
+++ b/qpid/cpp/src/tests/cluster_test.cpp
@@ -272,7 +272,7 @@ QPID_AUTO_TEST_CASE(testMessageTimeToLive) {
c0.session.queueDeclare("q", arg::durable=durableFlag);
c0.session.messageTransfer(arg::content=ttlMessage("a", "q", 200, durableFlag));
c0.session.messageTransfer(arg::content=makeMessage("b", "q", durableFlag));
- c0.session.messageTransfer(arg::content=ttlMessage("x", "p", 10000, durableFlag));
+ c0.session.messageTransfer(arg::content=ttlMessage("x", "p", 100000, durableFlag));
c0.session.messageTransfer(arg::content=makeMessage("y", "p", durableFlag));
cluster.add();
Client c2(cluster[1], "c2");