You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2012/03/06 16:54:12 UTC
svn commit: r1297542 - in /incubator/accumulo/branches/1.3: ./
src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java
Author: kturner
Date: Tue Mar 6 15:54:12 2012
New Revision: 1297542
URL: http://svn.apache.org/viewvc?rev=1297542&view=rev
Log:
ACCUMULO-395 give job tracker hostnames (instead of ips) for input splits so mappers will run locally (merged from 1.4)
Modified:
incubator/accumulo/branches/1.3/ (props changed)
incubator/accumulo/branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java
Propchange: incubator/accumulo/branches/1.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 6 15:54:12 2012
@@ -1,3 +1,3 @@
/incubator/accumulo/branches/1.3:1209653
/incubator/accumulo/branches/1.3.5rc:1209653,1209938
-/incubator/accumulo/branches/1.4:1209531
+/incubator/accumulo/branches/1.4:1209531,1297304-1297306
Modified: incubator/accumulo/branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java?rev=1297542&r1=1297541&r2=1297542&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java (original)
+++ incubator/accumulo/branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java Tue Mar 6 15:54:12 2012
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.math.BigInteger;
+import java.net.InetAddress;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
@@ -672,8 +673,17 @@ public class AccumuloInputFormat extends
if (!autoAdjust)
splitsToAdd = new HashMap<Range,ArrayList<String>>();
+ HashMap<String,String> hostNameCache = new HashMap<String,String>();
+
for (Entry<String,Map<KeyExtent,List<Range>>> tserverBin : binnedRanges.entrySet()) {
- String location = tserverBin.getKey().split(":", 2)[0];
+ String ip = tserverBin.getKey().split(":", 2)[0];
+ String location = hostNameCache.get(ip);
+ if (location == null) {
+ InetAddress inetAddress = InetAddress.getByName(ip);
+ location = inetAddress.getHostName();
+ hostNameCache.put(ip, location);
+ }
+
for (Entry<KeyExtent,List<Range>> extentRanges : tserverBin.getValue().entrySet()) {
Range ke = extentRanges.getKey().toDataRange();
for (Range r : extentRanges.getValue()) {