You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by li...@apache.org on 2014/04/22 20:18:39 UTC

svn commit: r1589227 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java

Author: liyin
Date: Tue Apr 22 18:18:39 2014
New Revision: 1589227

URL: http://svn.apache.org/r1589227
Log:
[master] fix TabpleInputFormatBase$reverseDNS.

Author: everyoung

Summary: Fix reverseDNS function which causes errors in TestHFileOutputFormat

Test Plan: run tests

Reviewers: manukranthk, daviddeng

Reviewed By: manukranthk

CC: aaiyer, hbase-dev@

Differential Revision: https://phabricator.fb.com/D1286952

Task ID: 3762458

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java?rev=1589227&r1=1589226&r2=1589227&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java Tue Apr 22 18:18:39 2014
@@ -21,14 +21,13 @@ package org.apache.hadoop.hbase.mapreduc
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.naming.NamingException;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -206,7 +205,7 @@ extends InputFormat<ImmutableBytesWritab
       String regionLocation;
       try {
         regionLocation = reverseDNS(regionAddress);
-      } catch (NamingException e) {
+      } catch (UnknownHostException e) {
         LOG.error("Cannot resolve the host name for " + regionAddress +
             " because of " + e);
         regionLocation = regionServerAddress.getHostname();
@@ -325,7 +324,7 @@ extends InputFormat<ImmutableBytesWritab
       regionAddress =
         regionServerAddress.getInetSocketAddress().getAddress();
       regionLocation = reverseDNS(regionAddress);
-    } catch (NamingException e) {
+    } catch (UnknownHostException e) {
       LOG.error("Cannot resolve the host name for " + regionAddress +
           " because of " + e);
       regionLocation = regionServerAddress.getHostname();
@@ -334,10 +333,12 @@ extends InputFormat<ImmutableBytesWritab
   }
 
   private static String reverseDNS(InetAddress ipAddress)
-  throws NamingException {
+    throws UnknownHostException {
     String hostName = reverseDNSCacheMap.get(ipAddress);
     if (hostName == null) {
-      hostName = DNS.reverseDns(ipAddress, nameServer);
+      // DNS.reverseDns(ipAddress, nameServer) is abandoned
+      // this code will do a reverse DNS lookup
+      hostName = InetAddress.getByName(ipAddress.getHostAddress()).getHostName();
       reverseDNSCacheMap.put(ipAddress, hostName);
     }
     return hostName;