bsglz commented on a change in pull request #1909:
URL: https://github.com/apache/hbase/pull/1909#discussion_r468398061



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java
##########
@@ -280,6 +280,18 @@ public long getBlocksLocalWithSsdWeight(String host) {
   private long getBlocksLocalityWeightInternal(String host, Visitor visitor) {
     long localityIndex = 0;
     HostAndWeight hostAndWeight = this.hostAndWeights.get(host);
+    // Compatible with local mode, see HBASE-24569
+    if (hostAndWeight == null) {
+      String currentHost = "";
+      try {
+        currentHost = DNS.getDefaultHost("default", "default");

Review comment:
       Comment above: "In my local env, the code below cost about 1μs~200μs, 
avg<5μs, much lesser than 1ms."
   
   ```
         try {
           currentHost = DNS.getDefaultHost("default", "default");
         } catch (Exception e) {
           // Just ignore, it's ok, avoid too many log info
         }
   ```




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