hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x...@apache.org
Subject hadoop git commit: HDFS-11860. Ozone: SCM: SCMContainerPlacementCapacity#chooseNode sometimes does not remove chosen node from healthy list. Contributed by Xiaoyu Yao.
Date Mon, 22 May 2017 20:19:47 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 b72ac9273 -> e0704c059


HDFS-11860. Ozone: SCM: SCMContainerPlacementCapacity#chooseNode sometimes does not remove
chosen node from healthy list. Contributed by Xiaoyu Yao.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e0704c05
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e0704c05
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e0704c05

Branch: refs/heads/HDFS-7240
Commit: e0704c059319a4bf3e0e006bdc376af70d35cbf5
Parents: b72ac92
Author: Xiaoyu Yao <xyao@apache.org>
Authored: Mon May 22 13:18:04 2017 -0700
Committer: Xiaoyu Yao <xyao@apache.org>
Committed: Mon May 22 13:18:04 2017 -0700

----------------------------------------------------------------------
 .../SCMContainerPlacementCapacity.java          | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e0704c05/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/placement/algorithms/SCMContainerPlacementCapacity.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/placement/algorithms/SCMContainerPlacementCapacity.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/placement/algorithms/SCMContainerPlacementCapacity.java
index da85eee..de9bb74 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/placement/algorithms/SCMContainerPlacementCapacity.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/placement/algorithms/SCMContainerPlacementCapacity.java
@@ -112,22 +112,22 @@ public final class SCMContainerPlacementCapacity extends SCMCommonPolicy
{
     int firstNodeNdx = getRand().nextInt(healthyNodes.size());
     int secondNodeNdx = getRand().nextInt(healthyNodes.size());
 
+    DatanodeID chosenID;
     // There is a possibility that both numbers will be same.
     // if that is so, we just return the node.
     if (firstNodeNdx == secondNodeNdx) {
-      return healthyNodes.get(firstNodeNdx);
+      chosenID = healthyNodes.get(firstNodeNdx);
+    } else {
+      DatanodeID firstNodeID = healthyNodes.get(firstNodeNdx);
+      DatanodeID secondNodeID = healthyNodes.get(secondNodeNdx);
+      SCMNodeMetric firstNodeMetric =
+          getNodeManager().getNodeStat(firstNodeID);
+      SCMNodeMetric secondNodeMetric =
+          getNodeManager().getNodeStat(secondNodeID);
+      chosenID = firstNodeMetric.isGreater(secondNodeMetric.get())
+          ? firstNodeID : secondNodeID;
     }
-
-    DatanodeID firstNodeID = healthyNodes.get(firstNodeNdx);
-    DatanodeID secondNodeID = healthyNodes.get(secondNodeNdx);
-    SCMNodeMetric firstNodeMetric = getNodeManager().getNodeStat(firstNodeID);
-    SCMNodeMetric secondNodeMetric = getNodeManager().getNodeStat(secondNodeID);
-
-    DatanodeID chosenID = firstNodeMetric.isGreater(secondNodeMetric.get())
-        ? firstNodeID : secondNodeID;
-
     healthyNodes.remove(chosenID);
     return chosenID;
   }
-
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message