summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/qpid/ha/Primary.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-08-06 20:44:58 +0000
committerAlan Conway <aconway@apache.org>2012-08-06 20:44:58 +0000
commitb4bf620d26fcb029186be1c1ab9b73ea05eb0d37 (patch)
tree81831e351264ab5a77dcb6b5faf6b74941a1668e /qpid/cpp/src/qpid/ha/Primary.cpp
parente4347cca011e0c7630e835bd96bc66b3e4e9a31c (diff)
downloadqpid-python-b4bf620d26fcb029186be1c1ab9b73ea05eb0d37.tar.gz
QPID-4191: HA removing self address breaks if a VIP is used.
Pre this patch the HA broker removed its own address from the set of cluster addresses to form the set of failover addresses. The goal was avoid useless self-connection attempts. However this was broken with a Virtual IP address where a single address is used for the entire cluster. The remove-self is not essential, self-connection attempts are prevented elsewhere. Backup brokers will be prevented from connecting to self by the same connection-observer as normal clients, and this patch addes self-connection checks ins This patch - removes the code to remove self-addresses - adds self-connection checks in ConnectionObserver - adds & reorders some log statements & comments for greater clarity. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1370002 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/ha/Primary.cpp')
-rw-r--r--qpid/cpp/src/qpid/ha/Primary.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/ha/Primary.cpp b/qpid/cpp/src/qpid/ha/Primary.cpp
index 69c94bfc7d..45a0e246f3 100644
--- a/qpid/cpp/src/qpid/ha/Primary.cpp
+++ b/qpid/cpp/src/qpid/ha/Primary.cpp
@@ -225,6 +225,12 @@ void Primary::opened(broker::Connection& connection) {
}
void Primary::closed(broker::Connection& connection) {
+ // NOTE: It is possible for a backup connection to be rejected while we are
+ // a backup, but closed() is called after we have become primary.
+ //
+ // For this reason we do not remove from the backups map here, the backups
+ // map holds all the backups we know about whether connected or not.
+ //
Mutex::ScopedLock l(lock);
BrokerInfo info;
if (ha::ConnectionObserver::getBrokerInfo(connection, info)) {
@@ -233,12 +239,6 @@ void Primary::closed(broker::Connection& connection) {
BackupMap::iterator i = backups.find(info.getSystemId());
if (i != backups.end()) i->second->setConnected(false);
}
- // NOTE: we do not remove from the backups map here, the backups map holds
- // all the backups we know about whether connected or not.
- //
- // It is possible for a backup connection to be rejected while we are a backup,
- // but the closed is seen after we have become primary. Removing the entry
- // from backups in this case would be incorrect.
}