-
Notifications
You must be signed in to change notification settings - Fork 589
HDDS-9944. NSSummary commands should close OzoneClient. #6018
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
Conversation
|
@adoroszlai Pls review. |
adoroszlai
left a comment
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.
Thanks @devmadhuu for working on this.
There is a second item in the task:
it should reuse client (or even bucket after lookup) for all checks
All namespace subcommands use these methods as the following:
Lines 109 to 112 in 2616f8e
| if (parent.isObjectStoreBucket(path) || | |
| !parent.bucketIsPresentInThePath(path)) { | |
| printBucketReminder(); | |
| } |
I don't think we need to use two separate clients for checking properties of the same bucket. The two methods can be combined.
Also, isFileSystemOptimizedBucket seems to be unused.
…even bucket after lookup) for all checks.
Thanks @adoroszlai for your review. I have implemented 2nd part of this JIRA : |
adoroszlai
left a comment
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.
Thanks @devmadhuu for updating the patch with re-use of client. Some minor items suggested.
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
Outdated
Show resolved
Hide resolved
…even bucket after lookup) for all checks.
…even bucket after lookup) for all checks.
adoroszlai
left a comment
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.
Thanks @devmadhuu for updating the patch.
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
Outdated
Show resolved
Hide resolved
…even bucket after lookup) for all checks.
|
@ArafatKhan2198 please review |
xBis7
left a comment
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.
@devmadhuu Thanks for the patch. I've tested it locally. LGTM!
| * @throws IOException | ||
| */ | ||
| public boolean bucketIsPresentInThePath(String path) throws IOException { | ||
| public boolean isNotValidBucketOrOBSBucket(String path) { |
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 can see that for every command, this check is preceded by a check to whether the path exists. Therefore, there is no issue of a NPException.
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.
Thank you for the modifications, @devmadhuu. I was just curious about why we are directly utilizing println() instead of employing logging. I believe even for a CLI command it usually does log the message on the console right?
System.out.println(
"Bucket layout couldn't be verified for path: " + ofsPath +
". Exception: " + e);
|
Thanks @devmadhuu for the fix, @ArafatKhan2198, @xBis7 for the review. |
Thanks @ArafatKhan2198 for review. These are CLI based interface, so need to print on console. |
What changes were proposed in this pull request?
This PR fixes the Ozone Client connection leak by closing all opened client connections in NSSummaryAdmin.java
NSSummaryAdmin commands leaves the Ozone client connections open which is not a good practice and may consume resources. So. this PR fixes that by closing all opened Ozone client connections.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9944
How was this patch tested?
This patch was tested using existing integration test
org.apache.hadoop.ozone.shell.TestNSSummaryAdmin