cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Fix Ec2Snitch regression introduced by CASSANDRA-5171
Date Mon, 06 May 2013 07:15:55 GMT
Updated Branches:
  refs/heads/cassandra-1.2 45e6d912c -> 59bd0e716


Fix Ec2Snitch regression introduced by CASSANDRA-5171

patch by vijay2win; reviewed by driftx and arya for CASSANDRA-5432


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

Branch: refs/heads/cassandra-1.2
Commit: 59bd0e7169c5fabc0e734ccbbbcd6964709577d0
Parents: 45e6d91
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Mon May 6 09:14:34 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon May 6 09:14:34 2013 +0200

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/locator/Ec2Snitch.java    |   15 ---------------
 .../cassandra/net/OutboundTcpConnectionPool.java   |    2 ++
 3 files changed, 3 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/59bd0e71/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4bdfb91..1abfc65 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * cqlsh: add CLUSTERING ORDER BY support to DESCRIBE (CASSANDRA-5528)
  * Add custom secondary index support to CQL3 (CASSANDRA-5484)
  * Fix repair hanging silently on unexpected error (CASSANDRA-5229)
+ * Fix Ec2Snitch regression introduced by CASSANDRA-5171 (CASSANDRA-5432)
 Merged from 1.1
  * Add retry mechanism to OTC for non-droppable_verbs (CASSANDRA-5393)
  * Use allocator information to improve memtable memory usage estimate

http://git-wip-us.apache.org/repos/asf/cassandra/blob/59bd0e71/src/java/org/apache/cassandra/locator/Ec2Snitch.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/Ec2Snitch.java b/src/java/org/apache/cassandra/locator/Ec2Snitch.java
index f36449d..a28e2a6 100644
--- a/src/java/org/apache/cassandra/locator/Ec2Snitch.java
+++ b/src/java/org/apache/cassandra/locator/Ec2Snitch.java
@@ -23,13 +23,11 @@ import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.InetAddress;
 import java.net.URL;
-import java.util.Map;
 
 import com.google.common.base.Charsets;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.cassandra.db.SystemTable;
 import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.gms.ApplicationState;
 import org.apache.cassandra.gms.EndpointState;
@@ -46,7 +44,6 @@ public class Ec2Snitch extends AbstractNetworkTopologySnitch
     protected static final String ZONE_NAME_QUERY_URL = "http://169.254.169.254/latest/meta-data/placement/availability-zone";
     private static final String DEFAULT_DC = "UNKNOWN-DC";
     private static final String DEFAULT_RACK = "UNKNOWN-RACK";
-    private Map<InetAddress, Map<String, String>> savedEndpoints;
     protected String ec2zone;
     protected String ec2region;
 
@@ -96,13 +93,7 @@ public class Ec2Snitch extends AbstractNetworkTopologySnitch
             return ec2zone;
         EndpointState state = Gossiper.instance.getEndpointStateForEndpoint(endpoint);
         if (state == null || state.getApplicationState(ApplicationState.RACK) == null)
-        {
-            if (savedEndpoints == null)
-                savedEndpoints = SystemTable.loadDcRackInfo();
-            if (savedEndpoints.containsKey(endpoint))
-                return savedEndpoints.get(endpoint).get("rack");
             return DEFAULT_RACK;
-        }
         return state.getApplicationState(ApplicationState.RACK).value;
     }
 
@@ -112,13 +103,7 @@ public class Ec2Snitch extends AbstractNetworkTopologySnitch
             return ec2region;
         EndpointState state = Gossiper.instance.getEndpointStateForEndpoint(endpoint);
         if (state == null || state.getApplicationState(ApplicationState.DC) == null)
-        {
-            if (savedEndpoints == null)
-                savedEndpoints = SystemTable.loadDcRackInfo();
-            if (savedEndpoints.containsKey(endpoint))
-                return savedEndpoints.get(endpoint).get("data_center");
             return DEFAULT_DC;
-        }
         return state.getApplicationState(ApplicationState.DC).value;
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/59bd0e71/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
index 88cad5b..1bc1893 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
@@ -132,6 +132,8 @@ public class OutboundTcpConnectionPool
 
     InetAddress endPoint()
     {
+        if (id.equals(FBUtilities.getBroadcastAddress()))
+            return FBUtilities.getLocalAddress();
         return resetedEndpoint == null ? id : resetedEndpoint;
     }
 


Mime
View raw message