You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by um...@apache.org on 2022/06/14 16:50:20 UTC
[ozone] branch master updated: HDDS-6830. EC: SCMContainerPlacementRackScatter may choose fewer nodes than required (#3511)
This is an automated email from the ASF dual-hosted git repository.
umamahesh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 4b425fd6cd HDDS-6830. EC: SCMContainerPlacementRackScatter may choose fewer nodes than required (#3511)
4b425fd6cd is described below
commit 4b425fd6cda5cafd08ba97bb544ac51e49dcfb2e
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Tue Jun 14 18:50:14 2022 +0200
HDDS-6830. EC: SCMContainerPlacementRackScatter may choose fewer nodes than required (#3511)
---
.../algorithms/SCMContainerPlacementRackScatter.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementRackScatter.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementRackScatter.java
index 25105497c5..8db7ed5434 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementRackScatter.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementRackScatter.java
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -139,8 +140,8 @@ public final class SCMContainerPlacementRackScatter
racks = sortRackWithExcludedNodes(racks, excludedNodes);
}
- List<Node> toChooseRacks = new LinkedList<>(racks);
- List<DatanodeDetails> chosenNodes = new ArrayList<>();
+ List<Node> toChooseRacks = new LinkedList<>();
+ Set<DatanodeDetails> chosenNodes = new LinkedHashSet<>();
List<Node> unavailableNodes = new ArrayList<>();
Set<Node> skippedRacks = new HashSet<>();
if (excludedNodes != null) {
@@ -166,7 +167,7 @@ public final class SCMContainerPlacementRackScatter
}
if (mutableFavoredNodes.size() > 0) {
- List<Node> chosenFavoredNodesInForLoop = new ArrayList<>();
+ List<DatanodeDetails> chosenFavoredNodesInForLoop = new ArrayList<>();
for (DatanodeDetails favoredNode : mutableFavoredNodes) {
Node curRack = getRackOfDatanodeDetails(favoredNode);
if (toChooseRacks.contains(curRack)) {
@@ -219,8 +220,9 @@ public final class SCMContainerPlacementRackScatter
retryCount = 0;
}
}
+ List<DatanodeDetails> result = new ArrayList<>(chosenNodes);
ContainerPlacementStatus placementStatus =
- validateContainerPlacement(chosenNodes, nodesRequiredToChoose);
+ validateContainerPlacement(result, nodesRequiredToChoose);
if (!placementStatus.isPolicySatisfied()) {
String errorMsg = "ContainerPlacementPolicy not met, currentRacks is" +
placementStatus.actualPlacementCount() + "desired racks is" +
@@ -237,7 +239,7 @@ public final class SCMContainerPlacementRackScatter
throw new SCMException(reason,
SCMException.ResultCodes.FAILED_TO_FIND_HEALTHY_NODES);
}
- return chosenNodes;
+ return result;
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org