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

Review of DiskBalancer

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Minor
    • Resolution: Unresolved
    • 3.2.0
    • None
    • datanode, hdfs
    • None
    • Patch

    Description

      • Use ArrayList instead of LinkedList. Especially because this code here uses the List#get() method, which is very slow for the LinkedList since it has to traverse every node to get to the offset: O(N^2)
          ExtendedBlock getNextBlock(List<FsVolumeSpi.BlockIterator> poolIters,
                                     DiskBalancerWorkItem item) {
            Preconditions.checkNotNull(poolIters);
            int currentCount = 0;
            ExtendedBlock block = null;
            while (block == null && currentCount < poolIters.size()) {
              currentCount++;
              int index = poolIndex++ % poolIters.size();
              FsVolumeSpi.BlockIterator currentPoolIter = poolIters.get(index);
              block = getBlockToCopy(currentPoolIter, item);
            }
      
      • Do not "log and throw" errors. This is an anti-pattern and should be avoided. Log or throw, but don't do both. Removed some logging
      • Improved other logging statements
      • Improved the hashcode method of one of the inner classes. It was instantiating a List and performing iteration for every call. Replace with Eclipse-generated hashcode method.
      • Fixed compiler warnings for deprecated code or code that was not parameterized
      • Fix check style issue

      Attachments

        1. HDFS-13978.1.patch
          20 kB
          David Mollitor

        Activity

          People

            belugabehr David Mollitor
            belugabehr David Mollitor
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: