Skip to content

Conversation

@DiannaHohensee
Copy link
Contributor

@DiannaHohensee DiannaHohensee commented Jan 14, 2025

The same RoutingAllocation instance is used to supply the nodes to both maps, so it should be safe to assume that we'll never find a node in one map and not the other. This is purely a transformational for-loop, it is not filtering anything out.

@DiannaHohensee DiannaHohensee self-assigned this Jan 14, 2025
@elasticsearchmachine elasticsearchmachine added v9.0.0 needs:triage Requires assignment of a team area label labels Jan 14, 2025
@DiannaHohensee DiannaHohensee force-pushed the 2025/01/14/ES-10341-cleanup branch from 8b13d12 to 160d763 Compare January 14, 2025 15:48
@DiannaHohensee DiannaHohensee added Team:Distributed Coordination Meta label for Distributed Coordination team >non-issue :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) and removed needs:triage Requires assignment of a team area label labels Jan 14, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

Comment on lines -188 to -190
if (node != null) {
filteredNodeAllocationStatsAndWeights.put(node, nodeStatsAndWeight.getValue());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nodesAllocationStatsAndWeights uses RoutingNodes, but RoutingNode can have at most one DiscoveryNode or null (I'm looking at Nullable node property). Potentially allocation.nodes().get(nodeStatsAndWeight.getKey()); might return null when RoutingNode does not have DiscoveryNode specified, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for looking into it. Following the allocation.routingNodes() and allocation.nodes() methods down, it looks like the routing nodes are instantiated here. It looks reasonable that the routing nodes has all of the nodes, from this code, but there are no interface guarantees that I see to feel good about that conclusion..

Looks like the Nullable was added in this commit, probably as a performance edge case.

Eh. I feel like it should have all the nodes, but also there are no guarantees around that, so this change probably isn't safe as the RoutingNodes code is today.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to pursue this PR or close it?

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

Labels

:Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) >non-issue Team:Distributed Coordination Meta label for Distributed Coordination team v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants