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

Double Synchronization in BlockReportLeaseManager

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.3.0
    • None
    • None
    • Reviewed

    Description

      BlockReportLeaseManager.java
        private synchronized long getNextId() {
          long id;
          do {
            id = nextId++;
          } while (id == 0);
          return id;
        }
      

      This is a private method and is synchronized, however, it is only be accessed from an already-synchronized method. No need to double-synchronize.

      https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockReportLeaseManager.java#L183-L189

      https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockReportLeaseManager.java#L227

      Attachments

        1. HDFS-14843.1.patch
          0.9 kB
          David Mollitor

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: