hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jing Zhao (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-10655) Fix path related byte array conversion bugs
Date Tue, 26 Jul 2016 23:00:25 GMT

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

Jing Zhao commented on HDFS-10655:
----------------------------------

The patch looks good to me overall. One comment about the change on {{byteArray2PathString}}:
{code}
-      if (i < pathComponents.length - 1) {
+      if (i < lastIndex) {
         result.append(Path.SEPARATOR_CHAR);
       }
{code}

This change actually changes the original semantic, and I do not think the original implementation
is a bug. For the byte[][] derived from path like "/foo/bar/baz", when calling {{byteArray2PathString(bytes,
0, 3)}}, the original implementation returns {{/foo/bar/}}, while the new implementation returns
{{/foo/bar}}. The original semantic is, if {{i}} is less than {{pathComponents.length - 1}},
we know the last component must be a directory, thus we can append a {{/}}.

> Fix path related byte array conversion bugs
> -------------------------------------------
>
>                 Key: HDFS-10655
>                 URL: https://issues.apache.org/jira/browse/HDFS-10655
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs
>            Reporter: Daryn Sharp
>            Assignee: Daryn Sharp
>         Attachments: HDFS-10655.patch, HDFS-10655.patch
>
>
> {{DFSUtil.bytes2ByteArray}} does not always properly handle runs of multiple separators,
nor does it handle relative paths correctly.
> {{DFSUtil.byteArray2PathString}} does not rebuild the path correctly unless the specified
range is the entire component array.



--
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