NihalJain commented on code in PR #6585:
URL: https://github.com/apache/hbase/pull/6585#discussion_r1908818264


##########
hbase-server/src/main/resources/hbase-webapps/master/table.jsp:
##########
@@ -104,35 +105,65 @@
   }
 
   /**
-   * Render an <td> tag contents server name which the given region deploys.
-   * Links to the server rs-status page.
-   * <td class="undeployed-region">not deployed</td> instead if can not find 
the deploy message.
-   * @return an <td> tag contents server name links to server rs-status page.
+   * Returns the socket address (host and port delimited with a colon - for 
example: server-01:16030) of the region server wrapped in an Optional.
+   * When ServerName is null, it returns an empty Optional.
+   *
+   * @param master not null HMaster instance used to get the region server 
info port.
+   * @param serverName not null ServerName instance, for figuring our the host 
name.
+   *
+   * @return the socket address of the region server in an Optional or empty 
Optional.
    */
-  private static String buildRegionDeployedServerTag(RegionInfo regionInfo, 
HMaster master,
-    Map<RegionInfo, ServerName> regionsToServer) {
-    ServerName serverName = regionsToServer.get(regionInfo);
-
+  private static Optional<String> buildRegionServerSocketAddress(HMaster 
master, ServerName serverName) {
     if (serverName == null) {
-      return "<td class=\"undeployed-region\">not deployed</td>";
+      return Optional.empty();
     }
 
+    // The host name portion should be safe, but I don't know how we handle 
IDNs so err on the side of failing safely.
     String hostName = serverName.getHostname();
-    String hostNameEncoded = URLEncoder.encode(hostName);
-    // This port might be wrong if RS actually ended up using something else.
-    int serverInfoPort = master.getRegionServerInfoPort(serverName);
-    String urlRegionServer = "//" + hostNameEncoded + ":" + serverInfoPort + 
"/rs-status";
+    String hostNameEncoded = URLEncoder.encode(hostName, 
StandardCharsets.UTF_8);

Review Comment:
   Yes we can fix the refactor as another ticket as well



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to