[
https://issues.apache.org/jira/browse/HDFS-8505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14574195#comment-14574195
]
Vinayakumar B commented on HDFS-8505:
-------------------------------------
bq. I did not understand, why we want to success ( Even which will not do any
change) in this scenario.. As 2 is not greater than 2,just we can fail.this is
what I feel..
For user, whats matters is the final length of the file, which is already as
expected, So I dont think this should be failure.
FYR, I also checked {{truncate}} command on linux with same size as the file
length, it didnt fail for me saying file already have the same length. Though,
linux version of {{truncate}} will not fail if you pass bigger size, instead of
truncating, it will extend file with 0 bytes.
bq. No, 2 is not larger than 2. Truncate should success
For me this looked like he agrees existing behaviour is correct.
bq. he is asking Konstantin Shvachko to check same.
[~brahmareddy], If [~shv] disagrees, then you are free to re-open
Thanks.
> Truncate should not be success when Truncate Size and Current Size are equal.
> -----------------------------------------------------------------------------
>
> Key: HDFS-8505
> URL: https://issues.apache.org/jira/browse/HDFS-8505
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Archana T
> Assignee: Brahma Reddy Battula
> Priority: Minor
> Attachments: HDFS-8505.patch
>
>
> Truncate should not be success when Truncate Size and Current Size are equal.
> $ ./hdfs dfs -cat /file
> abcdefgh
> $ ./hdfs dfs -truncate -w 2 /file
> Waiting for /file ...
> Truncated /file to length: 2
> $ ./hdfs dfs -cat /file
> ab
> {color:red}
> $ ./hdfs dfs -truncate -w 2 /file
> Truncated /file to length: 2
> {color}
> $ ./hdfs dfs -cat /file
> ab
> Expecting to throw Truncate Error:
> -truncate: Cannot truncate to a larger file size. Current size: 2, truncate
> size: 2
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)