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

Replace synchronized method in BlockReceiver with atomic value

    XMLWordPrintableJSON

    Details

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

      Description

      This synchronized block is protecting lastSentTime which is a native long. Can use AtomicLong and remove this synchronization.

        synchronized boolean packetSentInTime() {
          long diff = Time.monotonicNow() - lastSentTime;
          if (diff > maxSendIdleTime) {
            LOG.info("A packet was last sent " + diff + " milliseconds ago.");
            return false;
          }
          return true;
        }
      

      https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java#L392-L399

        Attachments

        1. HDFS-14260.2.patch
          3 kB
          David Mollitor
        2. HDFS-14260.1.patch
          3 kB
          David Mollitor

          Issue Links

            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: