Skip to content

HDDS-15146. Remove getDatanodeInfo(DatanodeDetails) from NodeManager.#10169

Closed
szetszwo wants to merge 6 commits into
apache:masterfrom
szetszwo:HDDS-15146
Closed

HDDS-15146. Remove getDatanodeInfo(DatanodeDetails) from NodeManager.#10169
szetszwo wants to merge 6 commits into
apache:masterfrom
szetszwo:HDDS-15146

Conversation

@szetszwo

@szetszwo szetszwo commented May 1, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

In SCMNodeManager, the underlying DatanodeDetails object actually is already a DatanodeInfo.

What is the link to the Apache JIRA

HDDS-15146

How was this patch tested?

Updating existing tests.

@adoroszlai adoroszlai changed the title HDDS-15146. Reomve getDatanodeInfo(DatanodeDetails) from NodeManager. HDDS-15146. Remove getDatanodeInfo(DatanodeDetails) from NodeManager. May 3, 2026

@sreejasahithi sreejasahithi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @szetszwo , left few comments

Comment on lines 435 to +438
public DatanodeInfo getDatanodeInfo(DatanodeDetails dd) {
if (dd instanceof DatanodeInfo) {
return (DatanodeInfo) dd;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is method is public but only used by MockNodeManager.

for (DatanodeDetails node : scm.getScmNodeManager().getNodes(opState, state)) {
NodeStatus ns = scm.getScmNodeManager().getNodeStatus(node);
DatanodeInfo datanodeInfo = scm.getScmNodeManager().getDatanodeInfo(node);
DatanodeInfo datanodeInfo = node instanceof DatanodeInfo ? (DatanodeInfo) node : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we need instanceof check here, we already know that getNodes returns DatanodeInfo?

List<Node> filteredScmNodes = scmNodes.stream()
.filter(n -> deadNodesOnRecon.contains(
DatanodeDetails.getFromProtoBuf(n.getNodeID())))
.filter(n -> deadNodesOnRecon.contains(n.getNodeID().getUuid()))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

n.getNodeID().getUuid() reads the deprecated string uuid field
instead we could use something like

.filter(n -> deadNodesOnRecon.contains(DatanodeID.fromProto(n.getNodeID().getId()).getID()))

@github-actions

Copy link
Copy Markdown

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions Bot added the stale label May 31, 2026
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

Thank you for your contribution. This PR is being closed due to inactivity. Please contact a maintainer if you would like to reopen it.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants