Skip to content

HDDS-10345. Sorting isn't needed when excluding Datanodes during Ratis Pipeline Creation#6224

Merged
adoroszlai merged 2 commits intoapache:masterfrom
siddhantsangwan:HDDS-10345
Feb 20, 2024
Merged

HDDS-10345. Sorting isn't needed when excluding Datanodes during Ratis Pipeline Creation#6224
adoroszlai merged 2 commits intoapache:masterfrom
siddhantsangwan:HDDS-10345

Conversation

@siddhantsangwan
Copy link
Contributor

@siddhantsangwan siddhantsangwan commented Feb 15, 2024

What changes were proposed in this pull request?

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:

  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;
  }

As you can see, this list is sorted before returning. I don't think sorting here is required since those Datanodes will just get excluded and we don't really need ordering.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-10345

How was this patch tested?

Existing tests.

Successful CI in my fork: https://github.com/siddhantsangwan/ozone/actions/runs/7916689597

@siddhantsangwan siddhantsangwan marked this pull request as ready for review February 20, 2024 04:36
Copy link
Contributor

@nandakumar131 nandakumar131 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Pending CI.

@adoroszlai adoroszlai merged commit c8e6cab into apache:master Feb 20, 2024
@adoroszlai
Copy link
Contributor

Thanks @siddhantsangwan for the patch, @nandakumar131 for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments