Skip to content

Conversation

@Tejaskriya
Copy link
Contributor

What changes were proposed in this pull request?

Currently, various ozone admin datanode commands use scmClient.queryNode() to retrieve datanode information. In case information about one datanode is needed, the only way to get it is to query all nodes information from the server and then filter it on the client side based on uuid or hostname, etc.
This PR introduces an API to fetch one datanode specific information through uuid of the datanode. This would reduce the data being transferred from the server to client.

What is the link to the Apache JIRA

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

How was this patch tested?

Added unit test in TestListInfoSubcommand

Copy link
Contributor

@myskov myskov left a comment

Choose a reason for hiding this comment

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

Why did you decide to add an additional request instead of extending queryNode?

}
} catch (NodeNotFoundException e) {
throw new IOException(
"An unexpected error occurred querying the NodeStatus", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

"An unexpected error" is a rather particular error, not unexpected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have used the same message used in queryNode() method earlier. I'm not sure what you are suggesting..

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess "NodeNotFound" should not happen, as we have just retrieved the node from NodeManager before querying its status, so the error really is unexpected. The message includes the stack trace, so it should be easy for a caller to figure out what was wrong.

@Tejaskriya
Copy link
Contributor Author

Why did you decide to add an additional request instead of extending queryNode?

I have overloaded the queryNode method in my current approach. Please review it and let me know your comments. Thank you.

@adoroszlai adoroszlai requested a review from sodonnel January 7, 2024 16:18
for (DatanodeDetails node : scm.getScmNodeManager().getAllNodes()) {
try {
if (node.getUuid().equals(uuid)) {
NodeStatus ns = scm.getScmNodeManager().getNodeStatus(node);
Copy link
Contributor

Choose a reason for hiding this comment

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

Node manager has an API to get a node by UUID directly:

  public DatanodeDetails getNodeByUuid(UUID uuid);

  public DatanodeDetails getNodeByUuid(String uuid);

So it would be better to use that than iterate all nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review! I have made the changes required to incorporate your suggestion and resolved the conflicts as well. Could you please review it and approve the workflows if the patch is good to go?

@sodonnel
Copy link
Contributor

Looks largely good. I just had one comment I left inline and there is also a conflict which needs resolved on TestListInfoSubcommand.java.

Copy link
Contributor

@sodonnel sodonnel left a comment

Choose a reason for hiding this comment

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

LGTM. We can commit when the CI goes green.

@adoroszlai adoroszlai merged commit 1c9f105 into apache:master Jan 19, 2024
@adoroszlai
Copy link
Contributor

Thanks @Tejaskriya for the patch, @myskov, @sodonnel for the review.

Tejaskriya added a commit to Tejaskriya/ozone that referenced this pull request Jan 24, 2024
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.

4 participants