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

Synchronization Issue With HashResolver

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 3.3.0
    • Component/s: federation
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      HashResolver.java
        private ConsistentHashRing getHashResolver(final Set<String> namespaces) {
          int hash = namespaces.hashCode();
          ConsistentHashRing resolver = this.hashResolverMap.get(hash);
          if (resolver == null) {
            resolver = new ConsistentHashRing(namespaces);
            this.hashResolverMap.put(hash, resolver);
          }
          return resolver;
        }
      

      The hashResolverMap is a ConcurrentHashMap so presumably there is concern here for concurrency issues. However, there is no synchronization around this method, so two threads could call get(hash) both see a 'null' value and then both add two entries into the Map. Add synchronization here.

        Attachments

        1. HDFS-13990.2.patch
          1 kB
          David Mollitor
        2. HDFS-13990.2.patch
          1 kB
          David Mollitor
        3. HDFS-13990.1.patch
          2 kB
          David Mollitor

          Activity

            People

            • Assignee:
              belugabehr David Mollitor
              Reporter:
              belugabehr David Mollitor
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: