[ 
https://issues.apache.org/jira/browse/HDFS-14542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16856419#comment-16856419
 ] 

Ayush Saxena commented on HDFS-14542:
-------------------------------------

If Quota by storage type is not set, It will loop 5 times here OK and then 
return, Correct.
And will return as part of this block :
{code:java}
    if (!isQuotaByStorageTypeSet()) {
      return;
    }
{code}

Quota by storage type not set, this part leads to Loop  and then return which 
you removed, Correct?

Now when you removed it didn't return, it moves ahead.


{code:java}
  for (StorageType t: StorageType.getTypesSupportingQuota()) {
      if (!isQuotaByStorageTypeSet(t)) {
        continue;
      }
{code}

Moves to this block now(Which it wouldn't have with current 
code).isQuotaByStorageTypeSet(t), Wouldn't  it not check here for each storage 
type? Which it didn't previously


> Remove redundant code when verify quota
> ---------------------------------------
>
>                 Key: HDFS-14542
>                 URL: https://issues.apache.org/jira/browse/HDFS-14542
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 3.1.1
>            Reporter: Jinglun
>            Assignee: Jinglun
>            Priority: Minor
>         Attachments: HDFS-14542.patch
>
>
> DirectoryWithQuotaFeature.verifyQuotaByStorageType() does the job of 
> verifying quota. It's redundant to call isQuotaByStorageTypeSet() because the 
> for each iterator nextline has done the same job.
> {code:java}
> private void verifyQuotaByStorageType(EnumCounters<StorageType> typeDelta) 
>      throws QuotaByStorageTypeExceededException {
>   if (!isQuotaByStorageTypeSet()) { // REDUNDANT.
>     return;
>   }
>   for (StorageType t: StorageType.getTypesSupportingQuota()) {
>     if (!isQuotaByStorageTypeSet(t)) { // CHECK FOR EACH STORAGETYPE.
>       continue;
>     }
>     if (Quota.isViolated(quota.getTypeSpace(t), usage.getTypeSpace(t),
>         typeDelta.get(t))) {
>       throw new QuotaByStorageTypeExceededException(
>       quota.getTypeSpace(t), usage.getTypeSpace(t) + typeDelta.get(t), t);
>     }
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to