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

HdfsServerConstants#ReplicaState#getState should avoid calling values() since it creates a temporary array

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.1
    • 2.8.0, 2.7.2, 3.0.0-alpha1
    • performance
    • None
    • Reviewed

    Description

      When the BufferDecoder in BlockListAsLongs converts the stored value to a ReplicaState enum it calls ReplicaState.getState(int) unfortunately this method creates a ReplicaState[] for each call since it calls ReplicaState.values().

      This patch creates a cached version of the values and thus avoid all allocation when doing the conversion.

      Attachments

        1. HADOOP-9221.001.patch
          1 kB
          Staffan Friberg

        Issue Links

          Activity

            People

              sfriberg Staffan Friberg
              sfriberg Staffan Friberg
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: