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

DirectoryWithQuotaFeature.quota costs additional memory even the storage type quota is not set.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.0
    • 2.10.0, 3.0.4, 3.3.0, 3.2.1, 2.9.3, 3.1.3
    • None
    • None

    Description

      Our XiaoMi HDFS is considering upgrading from 2.6 to 3.1. We notice the storage type quota 'tsCounts' is instantiated to EnumCounters<StorageType>(StorageType.class), so it will cost a long[5] even if we don't have any storage type quota on this inode(only space quota or name quota).

      In our cluster we have many dirs with quota and the NameNode's memory is in tension, so the additional cost will be a problem.
      See DirectoryWithQuotaFeature.Builder().

       

      class DirectoryWithQuotaFeature$Builder {
        public Builder() {
         this.quota = new QuotaCounts.Builder().nameSpace(DEFAULT_NAMESPACE_QUOTA).
         storageSpace(DEFAULT_STORAGE_SPACE_QUOTA).
         typeSpaces(DEFAULT_STORAGE_SPACE_QUOTA).build();// set default value -1.
         this.usage = new QuotaCounts.Builder().nameSpace(1).build();
        }
        public Builder typeSpaces(long val) {// set default value.
         this.tsCounts.reset(val);
         return this;
        }
      }
      class QuotaCounts$Builder {
        public Builder() {
          this.nsSsCounts = new EnumCounters<Quota>(Quota.class);
          this.tsCounts = new EnumCounters<StorageType>(StorageType.class);
        }
      }
      class EnumCounters {
        public EnumCounters(final Class<E> enumClass) {
          final E[] enumConstants = enumClass.getEnumConstants();
          Preconditions.checkNotNull(enumConstants);
          this.enumClass = enumClass;
          this.counters = new long[enumConstants.length];// new a long array here.
        }
      }
      

      Related to HDFS-14542.

       

      Attachments

        1. HDFS-14547.001.patch
          15 kB
          Jinglun
        2. HDFS-14547.002.patch
          15 kB
          Jinglun
        3. HDFS-14547.003.patch
          18 kB
          Jinglun
        4. HDFS-14547.004.patch
          18 kB
          Jinglun
        5. HDFS-14547.005.patch
          18 kB
          Jinglun
        6. HDFS-14547.006.patch
          21 kB
          Jinglun
        7. HDFS-14547.007.patch
          20 kB
          Jinglun
        8. HDFS-14547-branch-2.9.001.patch
          24 kB
          Jinglun
        9. HDFS-14547-branch-2.9.002.patch
          24 kB
          Jinglun
        10. HDFS-14547-branch-2.9.003.patch
          23 kB
          Jinglun
        11. HDFS-14547-design
          3 kB
          Jinglun
        12. HDFS-14547-patch003-Test Report.pdf
          71 kB
          Jinglun

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: