[ 
https://issues.apache.org/jira/browse/HADOOP-5143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12699005#action_12699005
 ] 

Qi Liu commented on HADOOP-5143:
--------------------------------

Simple. What if I want to seek relative to the end of a file? Also, it is 
reasonable to have a method which gives the boundaries where calling seek will 
not cause exceptions.
If the file size is less than 2G, available() would do the job. However, in 
many FSInputStream, available() is not working properly, and even possible to 
give me negative values if the file size exceeds 2G.
What I indeed want, is an available() which can give me a value larger than 2G 
(long). If such interface exists, the file length can be obtained by seek(0); 
availableLong();


> Add a method to get file length for Seekable, FSDataInputStream and libhdfs
> ---------------------------------------------------------------------------
>
>                 Key: HADOOP-5143
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5143
>             Project: Hadoop Core
>          Issue Type: New Feature
>          Components: dfs, fs, libhdfs
>    Affects Versions: 0.18.2
>            Reporter: Qi Liu
>         Attachments: HADOOP-5143.patch, hadoop.patch
>
>
> When open any seekable file, it should be able to get the length of the file 
> via Seekable interface, since the seek method should be able to detect 
> seeking beyond the end of file. Such interface can benefit distributed file 
> systems by saving a network round-trip of 
> FileSystem.getFileStatus(Path).getLen() for any open file.
> In libhdfs, such interface should also be exposed to make native program 
> taking advantage of this change.
> I have the changes locally for all FSInputStream concrete classes. The change 
> can be considered trivial, since some of the FSInputStream classes already 
> have a method named getFileLength(), or a member field named size/length/end.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to