[
https://issues.apache.org/jira/browse/HDFS-14984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16984589#comment-16984589
]
hemanthboyina commented on HDFS-14984:
--------------------------------------
if we set an invalid input 9223372036854775807(which is Long.MAX_VALUE) . it
should go through the if condition and throw exception (based on error thrown
for invalid input)
{code:java}
DFSClient.java
if ((namespaceQuota <= 0 &&
namespaceQuota != HdfsConstants.QUOTA_DONT_SET &&
namespaceQuota != HdfsConstants.QUOTA_RESET) ||
(storagespaceQuota < 0 &&
storagespaceQuota != HdfsConstants.QUOTA_DONT_SET &&
storagespaceQuota != HdfsConstants.QUOTA_RESET)) {
throw new IllegalArgumentException("Invalid values for quota : " +
namespaceQuota + " and " +
storagespaceQuota); } {code}
but in FSDirAttrOp.java , we have an else if check , if nsQuota equals
Long.MAX_VALUE , we are setting with Old NS Quota.
{code:java}
final QuotaCounts oldQuota = dirNode.getQuotaCounts();
final long oldNsQuota = oldQuota.getNameSpace();
final long oldSsQuota = oldQuota.getStorageSpace();
if (dirNode.isRoot() && nsQuota == HdfsConstants.QUOTA_RESET) {
nsQuota = HdfsConstants.QUOTA_DONT_SET;
} else if (nsQuota == HdfsConstants.QUOTA_DONT_SET) {
nsQuota = oldNsQuota;
}
// unchanged space/namespace quota
if (type == null && oldNsQuota == nsQuota && oldSsQuota == ssQuota) {
return null;
} {code}
Either the exception message was not proper or the if condition was not
correct in DFSClient .
please correct me if am wrong .
> HDFS setQuota: Error message should be added for invalid input max range
> value to hdfs dfsadmin -setQuota command
> -----------------------------------------------------------------------------------------------------------------
>
> Key: HDFS-14984
> URL: https://issues.apache.org/jira/browse/HDFS-14984
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: hdfs
> Affects Versions: 3.1.2
> Reporter: Souryakanta Dwivedy
> Priority: Minor
> Attachments: image-2019-11-13-14-05-19-603.png,
> image-2019-11-13-14-07-04-536.png
>
>
> An error message should be added for invalid input max range value
> "9223372036854775807" to hdfs dfsadmin -setQuota command
> * set quota for a directory with invalid input vlaue as
> "9223372036854775807"- set quota for a directory with invalid input vlaue as
> "9223372036854775807" the command will be successful without displaying any
> result.Quota value will not be set for the directory internally,but it
> will be better from user usage point of view if an error message will
> display for the invalid max range value "9223372036854775807" as it is
> displaying while setting the input value as "0" For example "hdfs
> dfsadmin -setQuota 9223372036854775807 /quota"
> !image-2019-11-13-14-05-19-603.png!
>
> * - Try to set quota for a directory with invalid input value as "0" It
> will throw an error message as "setQuota: Invalid values for quota : 0 and
> 9223372036854775807" For example "hdfs dfsadmin -setQuota 0 /quota"
> !image-2019-11-13-14-07-04-536.png!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]