Skip to content

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

Open
szetszwo wants to merge 6 commits intoapache:masterfrom
szetszwo:HDDS-15146
Open

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

Conversation

@szetszwo
Copy link
Copy Markdown
Contributor

@szetszwo szetszwo commented May 1, 2026

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
Copy link
Copy Markdown
Contributor

@sreejasahithi sreejasahithi left a comment

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()))

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.

2 participants