xiaoyuyao commented on a change in pull request #1371: URL: https://github.com/apache/hadoop-ozone/pull/1371#discussion_r489778062
########## File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java ########## @@ -98,8 +105,65 @@ private boolean exceedPipelineNumberLimit(ReplicationFactor factor) { return false; } + private Map<DatanodeDetails, Integer> getSuggestedLeaderCount( + List<DatanodeDetails> dns) { + Map<DatanodeDetails, Integer> suggestedLeaderCount = new HashMap<>(); + for (DatanodeDetails dn : dns) { + suggestedLeaderCount.put(dn, 0); + + Set<PipelineID> pipelineIDSet = getNodeManager().getPipelines(dn); + for (PipelineID pipelineID : pipelineIDSet) { + try { + Pipeline pipeline = getPipelineStateManager().getPipeline(pipelineID); + if (!pipeline.isClosed() + && dn.getUuid().equals(pipeline.getSuggestedLeaderId())) { Review comment: should we use getLeaderId() instead of getSuggestedLeaderId() here to reflect the actual leader count? ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org