virajjasani commented on a change in pull request #2669:
URL: https://github.com/apache/hbase/pull/2669#discussion_r526737575



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
##########
@@ -3485,25 +3488,26 @@ boolean checkFileSystem() {
   @Override
   public void updateRegionFavoredNodesMapping(String encodedRegionName,
       
List<org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName> 
favoredNodes) {
-    InetSocketAddress[] addr = new InetSocketAddress[favoredNodes.size()];
+    Address[] addr = new Address[favoredNodes.size()];
     // Refer to the comment on the declaration of regionFavoredNodesMap on why
-    // it is a map of region name to InetSocketAddress[]
+    // it is a map of region name to Address[]
     for (int i = 0; i < favoredNodes.size(); i++) {
-      addr[i] = 
InetSocketAddress.createUnresolved(favoredNodes.get(i).getHostName(),
+      addr[i] = Address.fromParts(favoredNodes.get(i).getHostName(),
           favoredNodes.get(i).getPort());
     }
     regionFavoredNodesMap.put(encodedRegionName, addr);
   }
 
   /**
    * Return the favored nodes for a region given its encoded name. Look at the
-   * comment around {@link #regionFavoredNodesMap} on why it is 
InetSocketAddress[]
-   *
+   * comment around {@link #regionFavoredNodesMap} on why we convert to 
InetSocketAddress[]
+   * here.
+   * @param encodedRegionName
    * @return array of favored locations
    */
   @Override
   public InetSocketAddress[] getFavoredNodesForRegion(String 
encodedRegionName) {
-    return regionFavoredNodesMap.get(encodedRegionName);
+    return 
Address.toSocketAddress(regionFavoredNodesMap.get(encodedRegionName));

Review comment:
       This resolution is required for each new StoreFileWriter creation right? 
Although it happens many times, is there any other usecase that I am missing 
here?

##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
##########
@@ -28,6 +28,8 @@
 import static org.apache.hadoop.hbase.util.FutureUtils.addListener;
 
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;

Review comment:
       nit: same here, no longer in use.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
##########
@@ -3485,25 +3488,26 @@ boolean checkFileSystem() {
   @Override
   public void updateRegionFavoredNodesMapping(String encodedRegionName,
       
List<org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName> 
favoredNodes) {
-    InetSocketAddress[] addr = new InetSocketAddress[favoredNodes.size()];
+    Address[] addr = new Address[favoredNodes.size()];
     // Refer to the comment on the declaration of regionFavoredNodesMap on why
-    // it is a map of region name to InetSocketAddress[]
+    // it is a map of region name to Address[]
     for (int i = 0; i < favoredNodes.size(); i++) {
-      addr[i] = 
InetSocketAddress.createUnresolved(favoredNodes.get(i).getHostName(),
+      addr[i] = Address.fromParts(favoredNodes.get(i).getHostName(),
           favoredNodes.get(i).getPort());
     }
     regionFavoredNodesMap.put(encodedRegionName, addr);
   }
 
   /**
    * Return the favored nodes for a region given its encoded name. Look at the
-   * comment around {@link #regionFavoredNodesMap} on why it is 
InetSocketAddress[]
-   *
+   * comment around {@link #regionFavoredNodesMap} on why we convert to 
InetSocketAddress[]
+   * here.
+   * @param encodedRegionName
    * @return array of favored locations
    */
   @Override
   public InetSocketAddress[] getFavoredNodesForRegion(String 
encodedRegionName) {
-    return regionFavoredNodesMap.get(encodedRegionName);
+    return 
Address.toSocketAddress(regionFavoredNodesMap.get(encodedRegionName));

Review comment:
       Where do we check if these addresses are resolved? Or we don't need to?

##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
##########
@@ -25,6 +25,7 @@
 import java.io.IOException;
 import java.lang.reflect.UndeclaredThrowableException;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;

Review comment:
       nit: both `InetAddress` and `InetSocketAddress` are no longer in use, 
imports can be removed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to