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

Reduce unnecessary byte-to-string transform operation in INodesInPath#toString

    Details

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

      Description

      Every time we invoke INodesInPath#toString(), we will trigger one time byte-to-string transform operation.

      private String toString(boolean vaildateObject) {
          if (vaildateObject) {
            validate();
          }
      
          final StringBuilder b = new StringBuilder(getClass().getSimpleName())
              .append(": path = ").append(DFSUtil.byteArray2PathString(path))
              .append("\n  inodes = ");
              ...
      }
      

      But actually we only need to do at most one time. In INodesInPath, it has defined one String type variable named pathname for storing the path string value. Here we can use getPath() to replace DFSUtil.byteArray2PathString(path).

        Attachments

          Activity

            People

            • Assignee:
              gabor.bota Gabor Bota
              Reporter:
              linyiqun Yiqun Lin
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: