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

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

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.1.0
    • 3.2.0
    • None
    • None
    • 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

        1. HDFS-13598.001.patch
          1 kB
          Gabor Bota

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment