-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDFS-14984. HDFS setQuota: Error message should be added for invalid … #2037
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
base: trunk
Are you sure you want to change the base?
Conversation
…input max range value to hdfs dfsadmin -setQuota command
💔 -1 overall
This message was automatically generated. |
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 @zhaoyim for your contribution, please fix the checkstyle refer to Yetus reports.
throw new IllegalArgumentException("Invalid values for " + | ||
"namespace quota : " + namespaceQuota); | ||
} | ||
if (storagespaceQuota < 0 && |
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.
this condition statement should be if (storagesapceQuoat <= 0)
?
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.
@Hexiaoqiao Thanks for review! (-9223372036854775808L - 1) == Long.MAX_VALUE
and QUOTA_RESET = -1L
so I think it's better to check more conditions.
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 mean if we should update storagespaceQuota < 0
to storagespaceQuota <= 0
, rather than whole condition statement.
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.
Yes, I see. If so, seems the -1L will throw the exception, but it should be OK for the internal use, such as clear quota.
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 @zhaoyim for your explanation. But I am still confused why this condition is different with namespacequota
? Sorry I do not find user manuals about set*Quota.
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.
@Hexiaoqiao In my understand, the diff is after created a dir, the name quota is already 1 and the name quota count it self, but the space quota can be 0.
"\" is not a valid value for a quota."); | ||
} | ||
if (HdfsConstants.QUOTA_DONT_SET == this.quota) { | ||
System.out.print("WARN: \"" + this.quota + |
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.
IMO, it should be using System.err.print
.
Another side, it is better to throw exception and no need to execute the following logic if meet invalid parameter.
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.
Changed to System.err.print
. And I agree with you, not need to execute the backward code, but here
my confusion is this message just a warning message, it is suitable to throw an Exception ? Any ideas? Thanks!
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.
or how about return directly? I think it is not necessary to send RPC request to NameNode if has checked the parameter is invalid.
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 tried return directly before, but there is an extra invalid message throw setQuota: null
. checked the code it is not easy to change, because the warn message is in the SetSpaceQuotaCommand
constructor. Maybe throw an exception or current solution are both OK. any ideas? Thanks!
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.
If that I think it is OK to throw exception that avoid send RPC request to NameNode if parameter is invalid which client has checked.
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.
Agree with U, change to throw exception. Thanks for confirm!
@@ -323,6 +334,11 @@ public void run(Path path) throws IOException { | |||
} catch (NumberFormatException nfe) { | |||
throw new IllegalArgumentException("\"" + str + "\" is not a valid value for a quota."); | |||
} | |||
if (HdfsConstants.QUOTA_DONT_SET == quota) { | |||
System.out.print("WARN: \"" + this.quota + |
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.
the same as last 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.
changed to System.err.print
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
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.
Please fix checkstyle following Yetus reports. https://builds.apache.org/job/hadoop-multibranch/job/PR-2037/3/artifact/out/diff-checkstyle-hadoop-hdfs-project.txt
throw new IllegalArgumentException("Invalid values for " + | ||
"namespace quota : " + namespaceQuota); | ||
} | ||
if (storagespaceQuota < 0 && |
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 @zhaoyim for your explanation. But I am still confused why this condition is different with namespacequota
? Sorry I do not find user manuals about set*Quota.
fixed style |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
…input max range value to hdfs dfsadmin -setQuota command
NOTICE
Please create an issue in ASF JIRA before opening a pull request,
and you need to set the title of the pull request which starts with
the corresponding JIRA issue number. (e.g. HADOOP-XXXXX. Fix a typo in YYY.)
For more details, please see https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute