hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yiqun Lin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-10619) Cache path in InodesInPath
Date Thu, 14 Jul 2016 01:36:21 GMT

    [ https://issues.apache.org/jira/browse/HDFS-10619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15376158#comment-15376158
] 

Yiqun Lin commented on HDFS-10619:
----------------------------------

Hi, [~daryn], the patch looks good. But the failed test seemed related. I tested you patch
in my local env. I found sometimes the bytes array {{path}} that passed will be like this:
{code}
[null, [102, 111, 111]]
{code}
The pathComponents[0] was null, but the pathComponents[1] has the values, then the method
{{DFSUtil#byteArray2PathString}} it will throw NPE.
Can we add this logic change to avoid this special case?
{code}
  public static String byteArray2PathString(byte[][] pathComponents,
      int offset, int length) {
    if (pathComponents.length == 0) {
      return "";
    }
    Preconditions.checkArgument(offset >= 0 && offset < pathComponents.length);
    Preconditions.checkArgument(length >= 0 && offset + length <=
        pathComponents.length);
    if (pathComponents.length == 1
        && (pathComponents[0] == null || pathComponents[0].length == 0)) {
      return Path.SEPARATOR;
    } else if (pathComponents.length > 1
        && (pathComponents[0] == null || pathComponents[0].length == 0)) {
      // Add this logic
      return "";
    }
    ...
{code}

> Cache path in InodesInPath
> --------------------------
>
>                 Key: HDFS-10619
>                 URL: https://issues.apache.org/jira/browse/HDFS-10619
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs
>            Reporter: Daryn Sharp
>            Assignee: Daryn Sharp
>         Attachments: HDFS-10619.patch
>
>
> INodesInPath#getPath, a frequently called method, dynamically builds the path.  IIP should
cache the path upon construction.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message