You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Allen Servedio <al...@gmail.com> on 2011/11/14 15:01:28 UTC
Ec2Snitch and Ec2MultiRegionSnitch - does us-west-2 cause a bug with
this snitch?
Hi,
As of Nov. 9, 2011 Amazon added us-west-2 (US West Oregon) region:
http://aws.typepad.com/aws/2011/11/now-open-us-west-portland-region.html
In looking at the EC2Snitch code (in the 0.8.x and 1.0.x branches), I see
it determining which data center (which I think is supposed to be
equivalent to region) it is in by this:
public Ec2Snitch() throws IOException, ConfigurationException
{
// Split "us-east-1a" or "asia-1a" into "us-east"/"1a" and "asia"/"1a".
String[] splits = awsApiCall(ZONE_NAME_QUERY_URL).split("-");
ec2zone = splits[splits.length - 1];
ec2region = splits.length < 3 ? splits[0] : splits[0] + "-" + splits[1];
logger.info("EC2Snitch using region: " + ec2region + ", zone:
" + ec2zone + ".");
}
The Ec2MultiRegionSnitch then has this reconnect logic - which I think the
existence of a us-west-1 and us-west-2 regions and the way the Ec2Snitch is
assigning data centers will cause this to break:
private void reConnect(InetAddress endpoint, VersionedValue versionedValue)
{
if (!getDatacenter(endpoint).equals(getDatacenter(public_ip)))
return; // do nothing return back...
try
{
InetAddress remoteIP = InetAddress.getByName(versionedValue.value);
MessagingService.instance().getConnectionPool(endpoint).reset(remoteIP);
logger.debug(String.format("Intiated reconnect to an
Internal IP %s for the %s", remoteIP, endpoint));
} catch (UnknownHostException e)
{
logger.error("Error in getting the IP address resolved: ", e);
}
}
Am I correct or do I not understand what was intended by these snitches?
Allen