Siddhant Sangwan created HDDS-10345:
---------------------------------------

             Summary: Sorting isn't needed when excluding Datanodes during 
Ratis Pipeline Creation
                 Key: HDDS-10345
                 URL: https://issues.apache.org/jira/browse/HDDS-10345
             Project: Apache Ozone
          Issue Type: Improvement
          Components: SCM
            Reporter: Siddhant Sangwan


RatisPipelineProvider is used to create a new Ratis pipeline when SCM is asked 
to provide one and existing pipelines can't be used. Both 
WritableRatisContainerProvider and BackgroundPipelineCreator create pipelines 
this way, dynamically and in the background, respectively.

As part of new pipeline creation, datanodes are excluded if they're already 
engaged in "ozone.scm.datanode.pipeline.limit" number of pipelines:
{code}
  private List<DatanodeDetails> filterPipelineEngagement() {
    List<DatanodeDetails> healthyNodes =
        getNodeManager().getNodes(NodeStatus.inServiceHealthy());
    List<DatanodeDetails> excluded = healthyNodes.stream()
        .map(d ->
            new DnWithPipelines(d,
                PipelinePlacementPolicy
                    .currentRatisThreePipelineCount(getNodeManager(),
                    getPipelineStateManager(), d)))
        .filter(d ->
            (d.getPipelines() >= getNodeManager().pipelineLimit(d.getDn())))
        .sorted(Comparator.comparingInt(DnWithPipelines::getPipelines))
        .map(d -> d.getDn())
        .collect(Collectors.toList());
    return excluded;
  }
{code}

I think sorting the Datanodes in this method is unnecessary as they only need 
to be excluded. This jira is meant to investigate and improve this code.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to