Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BC74B200C8B for ; Mon, 22 May 2017 22:19:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BB01C160BBF; Mon, 22 May 2017 20:19:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0E691160BAD for ; Mon, 22 May 2017 22:19:47 +0200 (CEST) Received: (qmail 76763 invoked by uid 500); 22 May 2017 20:19:47 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 76754 invoked by uid 99); 22 May 2017 20:19:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 May 2017 20:19:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 00A2FDFC2E; Mon, 22 May 2017 20:19:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: xyao@apache.org To: common-commits@hadoop.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer 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 +0000 (UTC) archived-at: Mon, 22 May 2017 20:19:48 -0000 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 Authored: Mon May 22 13:18:04 2017 -0700 Committer: Xiaoyu Yao 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