Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-14542

Remove redundant code when verify quota

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 3.1.1
    • None
    • None
    • None

    Description

      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.

      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);
          }
        }
      }
      

      Attachments

        1. HDFS-14542.patch
          0.9 kB
          Jinglun

        Issue Links

          Activity

            People

              LiJinglun Jinglun
              LiJinglun Jinglun
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: