mirror of https://github.com/apache/cassandra
Fix Ec2Snitch regression introduced by CASSANDRA-5171
patch by vijay2win; reviewed by driftx and arya for CASSANDRA-5432
This commit is contained in:
parent
45e6d912cc
commit
59bd0e7169
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ public class OutboundTcpConnectionPool
|
|||
|
||||
InetAddress endPoint()
|
||||
{
|
||||
if (id.equals(FBUtilities.getBroadcastAddress()))
|
||||
return FBUtilities.getLocalAddress();
|
||||
return resetedEndpoint == null ? id : resetedEndpoint;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue