cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1178554 - in /cassandra/branches/cassandra-0.8: CHANGES.txt src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
Date Mon, 03 Oct 2011 20:12:36 GMT
Author: jbellis
Date: Mon Oct  3 20:12:35 2011
New Revision: 1178554

URL: http://svn.apache.org/viewvc?rev=1178554&view=rev
Log:
check all interfaces for a match with split location before falling back to random replica
patch by Brian ONeill; reviewed by jbellis for CASSANDRA-3211

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1178554&r1=1178553&r2=1178554&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Mon Oct  3 20:12:35 2011
@@ -15,7 +15,9 @@
  * fix Scrub compaction finishing (CASSANDRA-3255)
  * Fix tool .bat files when CASSANDRA_HOME contains spaces (CASSANDRA-3258)
  * Evict gossip state immediately when a token is taken over by a new IP (CASSANDRA-3259)
- * allow wrapping ranges in Hadoop queries (CASSANDRA-3137)
+ * (Hadoop) allow wrapping ranges in queries (CASSANDRA-3137)
+ * (Hadoop) check all interfaces for a match with split location
+   before falling back to random replica (CASSANDRA-3211)
 
 
 0.8.6

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java?rev=1178554&r1=1178553&r2=1178554&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
Mon Oct  3 20:12:35 2011
@@ -23,6 +23,8 @@ package org.apache.cassandra.hadoop;
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
 import java.util.*;
@@ -31,14 +33,11 @@ import com.google.common.collect.Abstrac
 
 import org.apache.cassandra.auth.SimpleAuthenticator;
 import org.apache.cassandra.config.ConfigurationException;
-import org.apache.cassandra.db.*;
+import org.apache.cassandra.db.IColumn;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.TypeParser;
 import org.apache.cassandra.dht.IPartitioner;
 import org.apache.cassandra.thrift.*;
-import org.apache.cassandra.thrift.Column;
-import org.apache.cassandra.thrift.CounterColumn;
-import org.apache.cassandra.thrift.SuperColumn;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.Pair;
@@ -147,15 +146,18 @@ public class ColumnFamilyRecordReader ex
     // not necessarily on Cassandra machines, too.  This should be adequate for single-DC
clusters, at least.
     private String getLocation()
     {
-        InetAddress[] localAddresses;
+        ArrayList<InetAddress> localAddresses = new ArrayList<InetAddress>();
         try
         {
-            localAddresses = InetAddress.getAllByName(InetAddress.getLocalHost().getHostAddress());
+            Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
+            while (nets.hasMoreElements())
+                localAddresses.addAll(Collections.list(nets.nextElement().getInetAddresses()));
         }
-        catch (UnknownHostException e)
+        catch (SocketException e)
         {
             throw new AssertionError(e);
         }
+
         for (InetAddress address : localAddresses)
         {
             for (String location : split.getLocations())



Mime
View raw message