[
https://issues.apache.org/jira/browse/HDFS-8493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14589321#comment-14589321
]
Haohui Mai commented on HDFS-8493:
----------------------------------
Thanks for the work. The patch looks good to me. Some minor comments:
{code}
+ String src = fsd.resolvePath(pc, srcArg, pathComponents);
{code}
The resolution should be in the lock of {{FSDirectory}}.
{code}
+ FSPermissionChecker pc = fsd.getPermissionChecker();
{code}
{{getPermissionChecker()}} is a blocking call. It should be done outside of the
lock of {{FSNameSystem}}.
{code}
+ String srcArg = src;
+ NameNode.stateChangeLog.debug(
+ "DIR* NameSystem.truncate: src={} newLength={}", srcArg, newLength);
+ if (newLength < 0) {
+ throw new HadoopIllegalArgumentException(
+ "Cannot truncate to a negative file size: " + newLength + ".");
+ }
+ HdfsFileStatus stat = null;
{code}
The code can be moved out of the first try block.
> Consolidate truncate() related implementation in a single class
> ---------------------------------------------------------------
>
> Key: HDFS-8493
> URL: https://issues.apache.org/jira/browse/HDFS-8493
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Reporter: Haohui Mai
> Assignee: Rakesh R
> Attachments: HDFS-8493-001.patch, HDFS-8493-002.patch,
> HDFS-8493-003.patch, HDFS-8493-004.patch, HDFS-8493-005.patch,
> HDFS-8493-006.patch
>
>
> This jira proposes to consolidate truncate() related methods into a single
> class.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)