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

Colin Patrick McCabe commented on HDFS-7659:
--------------------------------------------

Thanks for the patch.

A few comments: We should not use a Precondition check here.  Those checks are 
for guarding against logic errors, not invalid input from the HDFS user.  You 
should throw a {{HadoopIllegalArgumentException}} when an invalid truncate size 
is passed.  Also, please add a unit test.  It is trivial to add a unit test for 
this and it will prevent this from regressing in the future.

> We should check the new length of truncate can't be a negative value.
> ---------------------------------------------------------------------
>
>                 Key: HDFS-7659
>                 URL: https://issues.apache.org/jira/browse/HDFS-7659
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: datanode, namenode
>            Reporter: Yi Liu
>            Assignee: Yi Liu
>             Fix For: 3.0.0
>
>         Attachments: HDFS-7659.001.patch
>
>
> It's obvious that we should check the new length of truncate can't be a 
> negative value.



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

Reply via email to