nandakumar131 commented on a change in pull request #2416:
URL: https://github.com/apache/ozone/pull/2416#discussion_r680141848
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMCommonPlacementPolicy.java
##########
@@ -314,4 +316,14 @@ public ContainerPlacementStatus validateContainerPlacement(
return new ContainerPlacementStatusDefault(
(int)currentRackCount, requiredRacks, numRacks);
}
+
+ /**
+ * Removes the datanode peers from all the existing pipelines for this dn.
+ */
+ public void removePeers(DatanodeDetails dn,
+ List<DatanodeDetails> healthyList) {
+ if (ScmUtils.shouldRemovePeers(conf)) {
Review comment:
Instead of calling `ScmUtils.shouldRemovePeers(conf)` repeatedly, can
this value be stored in an instance variable?
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
##########
@@ -885,6 +888,29 @@ public int minPipelineLimit(List<DatanodeDetails> dnList) {
return Collections.min(pipelineCountList);
}
+ @Override
+ public Collection<DatanodeDetails> getPeerList(DatanodeDetails dn) {
+ HashSet<DatanodeDetails> dns = new HashSet<>();
+ Preconditions.checkNotNull(dn);
+ Set<PipelineID> pipelines =
+ nodeStateManager.getPipelineByDnID(dn.getUuid());
+ if (!pipelines.isEmpty()) {
+ pipelines.forEach(id -> {
+ try {
+ Pipeline pipeline =
+ scmContext.getScm().getPipelineManager().getPipeline(id);
Review comment:
We can cache the `PipelineManager` instance outside of `forEach` instead
of making `scmContext.getScm().getPipelineManager()` call inside `forEach`
every time.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]