[
https://issues.apache.org/jira/browse/HADOOP-9495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13639273#comment-13639273
]
Steve Loughran commented on HADOOP-9495:
----------------------------------------
h2. Proposed tests
h3. Tests to verify offset validation
# create and open a file such that {{length(file) > 0}}, verify {{getPos()==0}}
(SEEK1)
# {{seek(length(file))}}, {{verify getPos()==length(file)} OR {{IOException}}
is raised (indicating that {{seek()}} isn't implemented) (SEEK2, SEEK7)
h3. For input streams that do indicate {{seek()}} is supported:
# {{seek(length(file)) && getPos()==length(file) && read()==-1}} (SEEK-READ3)
# {{seek(length(file)+1) => EOFException}}. If an exception is not raised, an
IOException must be raised on the following {{read()}}. (SEEK5, SEEK6)
# {{seek(-1) => IOException}} (SEEK4)
# close file && {{seek(0) => IOException} (SEEK3)
h3. Tests for {{seek()}} on empty files
# create and open a file such that {{length(file) == 0}}
# Verify {{getPos()==0}} (SEEK1)
# Verify that {{seek(0)}} succeeds. (degenerate case of SEEK7)
# verify that {{read()==-1}} (degenerate case of SEEK-READ3)
h3. Tests to verify {{seek()}} actually changes the location for future reads.
(SEEK-READ2)
# Create a large file s.t {{length(file) > getBlocksize()}}, with a dataset
such that the {{byte[L] == (L&0xff)}}
# Verify that after a {{seek()}}, {{read()}} returns the data at the seek
location. This must work for forward and backwards seeks.
# Verify that after a {{seek()}}, a {{PositionedReadable.read(byte[])}} returns
the bytes of data at the seek location. This must work for forward and
backwards seeks.
# Repeat for very large seek offsets to ensure that filesystems with local
caches/buffers handle longer range seeks correctly.
h3. PositionedReadable/Seek Integration:
# using the file of the SEEK-READ2 tests, execute positioned reads in all the
relevant corner cases (SEEK-READ5, SEEK-READ6, SEEK-READ7)
> Define behaviour of Seekable.seek(), write tests, fix all hadoop
> implementations for compliance
> -----------------------------------------------------------------------------------------------
>
> Key: HADOOP-9495
> URL: https://issues.apache.org/jira/browse/HADOOP-9495
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs
> Affects Versions: 1.2.0, 3.0.0
> Reporter: Steve Loughran
> Assignee: Steve Loughran
>
> {{Seekable.seek()}} seems a good starting point for specifying, testing and
> implementing FS API compliance: one method, relatively non-ambiguous
> semantics, easily assessed used in the Hadoop codebase. Specify and test it
> first
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira