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

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.1
    • Fix Version/s: 2.8.0, 2.7.2, 3.0.0-alpha1
    • Component/s: performance
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      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

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: