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



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java
##########
@@ -228,33 +228,49 @@ public long getUniqueBlocksTotalWeight() {
    * Implementations 'visit' hostAndWeight.
    */
   public interface Visitor {
-    float visit(final HostAndWeight hostAndWeight);
+    long visit(final HostAndWeight hostAndWeight);
   }
 
   /**
    * @param host the host name
    * @return the locality index of the given host
    */
   public float getBlockLocalityIndex(String host) {
-    return getBlockLocalityIndexInternal(host,
-      e -> (float) e.weight / (float) uniqueBlocksTotalWeight);
+    return (float) getBlocksLocalityWeightInternal(host, e -> e.weight)

Review comment:
       Fixed.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java
##########
@@ -228,33 +228,49 @@ public long getUniqueBlocksTotalWeight() {
    * Implementations 'visit' hostAndWeight.
    */
   public interface Visitor {
-    float visit(final HostAndWeight hostAndWeight);
+    long visit(final HostAndWeight hostAndWeight);
   }
 
   /**
    * @param host the host name
    * @return the locality index of the given host
    */
   public float getBlockLocalityIndex(String host) {
-    return getBlockLocalityIndexInternal(host,
-      e -> (float) e.weight / (float) uniqueBlocksTotalWeight);
+    return (float) getBlocksLocalityWeightInternal(host, e -> e.weight)
+      / (float) uniqueBlocksTotalWeight;
   }
 
   /**
    * @param host the host name
    * @return the locality index with ssd of the given host
    */
   public float getBlockLocalityIndexForSsd(String host) {
-    return getBlockLocalityIndexInternal(host,
-      e -> (float) e.weightForSsd / (float) uniqueBlocksTotalWeight);
+    return (float) getBlocksLocalityWeightInternal(host, e -> e.weightForSsd)

Review comment:
       Fixed.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java
##########
@@ -228,33 +228,49 @@ public long getUniqueBlocksTotalWeight() {
    * Implementations 'visit' hostAndWeight.
    */
   public interface Visitor {
-    float visit(final HostAndWeight hostAndWeight);
+    long visit(final HostAndWeight hostAndWeight);
   }
 
   /**
    * @param host the host name
    * @return the locality index of the given host
    */
   public float getBlockLocalityIndex(String host) {
-    return getBlockLocalityIndexInternal(host,
-      e -> (float) e.weight / (float) uniqueBlocksTotalWeight);
+    return (float) getBlocksLocalityWeightInternal(host, e -> e.weight)
+      / (float) uniqueBlocksTotalWeight;
   }
 
   /**
    * @param host the host name
    * @return the locality index with ssd of the given host
    */
   public float getBlockLocalityIndexForSsd(String host) {
-    return getBlockLocalityIndexInternal(host,
-      e -> (float) e.weightForSsd / (float) uniqueBlocksTotalWeight);
+    return (float) getBlocksLocalityWeightInternal(host, e -> e.weightForSsd)
+      / (float) uniqueBlocksTotalWeight;
+  }
+
+  /**
+   * @param host the host name
+   * @return the blocks local weight of the given host
+   */
+  public long getBlocksLocalWeight(String host) {
+    return getBlocksLocalityWeightInternal(host, e -> e.weight);

Review comment:
       Fixed.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java
##########
@@ -228,33 +228,49 @@ public long getUniqueBlocksTotalWeight() {
    * Implementations 'visit' hostAndWeight.
    */
   public interface Visitor {
-    float visit(final HostAndWeight hostAndWeight);
+    long visit(final HostAndWeight hostAndWeight);
   }
 
   /**
    * @param host the host name
    * @return the locality index of the given host
    */
   public float getBlockLocalityIndex(String host) {
-    return getBlockLocalityIndexInternal(host,
-      e -> (float) e.weight / (float) uniqueBlocksTotalWeight);
+    return (float) getBlocksLocalityWeightInternal(host, e -> e.weight)
+      / (float) uniqueBlocksTotalWeight;
   }
 
   /**
    * @param host the host name
    * @return the locality index with ssd of the given host
    */
   public float getBlockLocalityIndexForSsd(String host) {
-    return getBlockLocalityIndexInternal(host,
-      e -> (float) e.weightForSsd / (float) uniqueBlocksTotalWeight);
+    return (float) getBlocksLocalityWeightInternal(host, e -> e.weightForSsd)
+      / (float) uniqueBlocksTotalWeight;
+  }
+
+  /**
+   * @param host the host name
+   * @return the blocks local weight of the given host
+   */
+  public long getBlocksLocalWeight(String host) {
+    return getBlocksLocalityWeightInternal(host, e -> e.weight);
+  }
+
+  /**
+   * @param host the host name
+   * @return the blocks local with ssd weight of the given host
+   */
+  public long getBlocksLocalWithSsdWeight(String host) {
+    return getBlocksLocalityWeightInternal(host, e -> e.weightForSsd);

Review comment:
       Fixed.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to