-
Notifications
You must be signed in to change notification settings - Fork 620
HDDS-2671 Have NodeManager.getNodeStatus throw NodeNotFoundException #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,8 @@ public void setPipelines(DatanodeDetails dd, int count) { | |
| * Inservice and Healthy NodeStatus. | ||
| */ | ||
| @Override | ||
| public NodeStatus getNodeStatus(DatanodeDetails datanodeDetails) { | ||
| public NodeStatus getNodeStatus(DatanodeDetails datanodeDetails) | ||
| throws NodeNotFoundException { | ||
|
Comment on lines
+90
to
+91
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this method really throw
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea it would make more sense for this method do thow NodeNotFoundException, however, I cheated somewhat when using this class in an earlier patch within TestReplicationManager. Replication manager only calls the "getNodeStatus()" method of the NodeManager, and to avoid having to change too many existing tests I defaulted this to return "Healthy + Inservice" for any node not registered so the existing tests passed without modification. I have an existing Jira HDDS-2673 to refactor and merge MockNodeManager and SimpleMockNodeManager into one, so perhaps we could improve this issue as part of that?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sure, that's fine, too.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a comment to HDDS-2673 to remind about this when I get to working on it. |
||
| DatanodeInfo dni = nodeMap.get(datanodeDetails.getUuid()); | ||
| if (dni != null) { | ||
| return dni.getNodeStatus(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be more specific, eg.
IllegalStateExceptionseems to be a good candidate. If you agree, please remember to update the correspondingcatch, too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that makes sense. This means that is a "real" runtime exception occurs, the catch will not stop it propagating up the stack and instead we only catch this more specific exception. I have made this change.