hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron T. Myers (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-2875) Clean up LeaseManager#changeLease
Date Wed, 01 Feb 2012 23:23:56 GMT

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

Aaron T. Myers commented on HDFS-2875:

# The parameter "dst" is unused except for debugging output.
# The String parameter "overwrite" is poorly named, and is only used for getting its length,
so should be an integer.
# "{{final String newpath = replaceBy + oldpath.substring(len);}}" - this code is extremely
fragile. It works for directories because "replaceBy" will be a path prefix to replace, and
{{oldpath}} will be the part of the path that is not replaced, but rather appended to replaceBy,
since when renaming a directory to another already-existing directory, HDFS will actually
nest the directories. It works incidentally for files only if "len"  is equal to "oldpath.length()",
which callers must be careful to make sure of.
# Since all the logic uses strings, multiple trailing slashes aren't accounted for, even though
these are logically the same directory. This requires careful handling on the part of callers
of LeaseManager#changeLease, and thus there's a bunch of logic in FSNamesystem#unprotectedChangeLease
which just sets up the parameters correctly for LeaseManager#changeLease.
# There's no javadoc for LeaseManager#changeLease, so it's not clear what the intended API
is, or how the four string parameters are used.
# FSNamesystem#unprotectedChangeLease is the only caller of the {{FSNamesystem#isRoot(Path)}}
method, which is needlessly a class method. This method should at least be static, since it
accesses no per-instance state, and should probably actually move to the {{Path}} class, since
it has nothing to do with FSNamesystem per se.
# The test for correct lease change behavior upon renaming a directory above an open file
is in TestSaveNamespace. There's no reason this string manipulation code should require starting
a minicluster and saving the namespace. The code should be restructured to allow for better
> Clean up LeaseManager#changeLease
> ---------------------------------
>                 Key: HDFS-2875
>                 URL: https://issues.apache.org/jira/browse/HDFS-2875
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>    Affects Versions: 0.24.0
>            Reporter: Aaron T. Myers
>            Priority: Minor
> The code for {{LeaseManager#changeLease}} and the associated {{FSNamesystem#unprotectedChangeLease}}
is very fragile, and can be improved in several ways.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message