bsglz commented on a change in pull request #1337:
URL: https://github.com/apache/hbase/pull/1337#discussion_r439799872
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java
##########
@@ -122,14 +134,27 @@ public synchronized String toString() {
* @param weight the weight
*/
public void addHostsAndBlockWeight(String[] hosts, long weight) {
+ addHostsAndBlockWeight(hosts, weight, null);
+ }
+ /**
+ * add some weight to a list of hosts, update the value of unique block
weight
+ * @param hosts the list of the host
+ * @param weight the weight
+ */
+ public void addHostsAndBlockWeight(String[] hosts, long weight,
StorageType[] storageTypes) {
if (hosts == null || hosts.length == 0) {
// erroneous data
return;
}
addUniqueWeight(weight);
- for (String hostname : hosts) {
- addHostAndBlockWeight(hostname, weight);
+ for (int i = 0; i < hosts.length; i++) {
+ long weightForSsd = 0;
+ if (storageTypes != null && storageTypes.length == hosts.length
+ && storageTypes[i] == StorageType.SSD) {
+ weightForSsd = weight;
Review comment:
Yeah, it seems better, thanks.
----------------------------------------------------------------
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]