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

Review of MovedBlocks

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Minor
    • Resolution: Unresolved
    • 3.2.0
    • None
    • balancer & mover
    • None
    • Patch

    Description

      Internal data structure needs to be protected (synchronized) but is scoped as protected so any sub-class could modify without a lock. Synchronize the collection itself for protection. It also returns the internal data structure in getLocations so the structure could be modified outside of the lock. Create a copy instead.

          /** The locations of the replicas of the block. */
          protected final List<L> locations = new ArrayList<L>(3);
          
          public Locations(Block block) {
            this.block = block;
          }
          
          /** clean block locations */
          public synchronized void clearLocations() {
            locations.clear();
          }
      ...
         /** @return its locations */
          public synchronized List<L> getLocations() {
            return locations;
          }
      

       
      https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/MovedBlocks.java#L43

      Also, remove a bunch of superfluous and complicated code.

      Attachments

        1. HDFS-14862.1.patch
          4 kB
          David Mollitor

        Activity

          People

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

            Dates

              Created:
              Updated: