cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject [2/6] cassandra git commit: Add local address entry in PropertyFileSnitch
Date Thu, 01 Sep 2016 21:13:19 GMT
Add local address entry in PropertyFileSnitch

Patch by Branimir Lambov; reviewed by Carl Yeksigian for CASSANDRA-11332


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ad4a91da
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ad4a91da
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ad4a91da

Branch: refs/heads/cassandra-3.0
Commit: ad4a91da788d58a3d473e8e5e05caeb9339443f4
Parents: 40c2d45
Author: Carl Yeksigian <carl@apache.org>
Authored: Thu Sep 1 17:10:09 2016 -0400
Committer: Carl Yeksigian <carl@apache.org>
Committed: Thu Sep 1 17:10:09 2016 -0400

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../org/apache/cassandra/locator/PropertyFileSnitch.java | 11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ad4a91da/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a6a1114..fae713e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.8
+ * Add local address entry in PropertyFileSnitch (CASSANDRA-11332)
  * cqlshlib tests: increase default execute timeout (CASSANDRA-12481)
  * Forward writes to replacement node when replace_address != broadcast_address (CASSANDRA-8523)
  * Enable repair -pr and -local together (fix regression of CASSANDRA-7450) (CASSANDRA-12522)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ad4a91da/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java b/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
index bfd8e8e..8cc6549 100644
--- a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
+++ b/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
@@ -186,10 +186,17 @@ public class PropertyFileSnitch extends AbstractNetworkTopologySnitch
                 reloadedMap.put(host, token);
             }
         }
-        if (reloadedDefaultDCRack == null && !reloadedMap.containsKey(FBUtilities.getBroadcastAddress()))
+        InetAddress broadcastAddress = FBUtilities.getBroadcastAddress();
+        String[] localInfo = reloadedMap.get(broadcastAddress);
+        if (reloadedDefaultDCRack == null && localInfo == null)
             throw new ConfigurationException(String.format("Snitch definitions at %s do not
define a location for " +
                                                            "this node's broadcast address
%s, nor does it provides a default",
-                                                           SNITCH_PROPERTIES_FILENAME, FBUtilities.getBroadcastAddress()));
+                                                           SNITCH_PROPERTIES_FILENAME, broadcastAddress));
+        // OutboundTcpConnectionPool.getEndpoint() converts our broadcast address to local,
+        // make sure we can be found at that as well.
+        InetAddress localAddress = FBUtilities.getLocalAddress();
+        if (!localAddress.equals(broadcastAddress) && !reloadedMap.containsKey(localAddress))
+            reloadedMap.put(localAddress, localInfo);
 
         if (isUpdate && !livenessCheck(reloadedMap, reloadedDefaultDCRack))
             return;


Mime
View raw message