cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/14] git commit: Merge branch 'cassandra-1.0' into cassandra-1.1.0
Date Wed, 14 Mar 2012 04:25:53 GMT
Merge branch 'cassandra-1.0' into cassandra-1.1.0


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

Branch: refs/heads/cassandra-1.1.0
Commit: c29037290a204ba7624646e99780e32e4157ae1a
Parents: e7e984a f42ec6d
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Tue Mar 13 23:24:29 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Mar 13 23:24:29 2012 -0500

----------------------------------------------------------------------
 examples/simple_authentication/README.txt          |   11 +++++++++++
 .../org/apache/cassandra/locator/Ec2Snitch.java    |    9 +++++++--
 .../apache/cassandra/locator/EC2SnitchTest.java    |   14 +++++++++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c2903729/src/java/org/apache/cassandra/locator/Ec2Snitch.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/locator/Ec2Snitch.java
index 4ffc0e8,139c305..1dced95
--- a/src/java/org/apache/cassandra/locator/Ec2Snitch.java
+++ b/src/java/org/apache/cassandra/locator/Ec2Snitch.java
@@@ -51,13 -51,18 +51,18 @@@ public class Ec2Snitch extends Abstract
  
      public Ec2Snitch() throws IOException, ConfigurationException
      {
+         String az = awsApiCall(ZONE_NAME_QUERY_URL);
          // Split "us-east-1a" or "asia-1a" into "us-east"/"1a" and "asia"/"1a".
-         String[] splits = awsApiCall(ZONE_NAME_QUERY_URL).split("-");
+         String[] splits = az.split("-");
          ec2zone = splits[splits.length - 1];
-         ec2region = splits.length < 3 ? splits[0] : splits[0] + "-" + splits[1];
+ 
+         // hack for CASSANDRA-4026
+         ec2region = az.substring(0, az.length() - 1);
+         if (ec2region.endsWith("1"))
+             ec2region = az.substring(0, az.length() - 3);
          logger.info("EC2Snitch using region: " + ec2region + ", zone: " + ec2zone + ".");
      }
 -    
 +
      String awsApiCall(String url) throws IOException, ConfigurationException
      {
          // Populate the region and zone by introspection, fail if 404 on metadata

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c2903729/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java
----------------------------------------------------------------------


Mime
View raw message