Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-17382

AbfsInputStream#seek throws EOFException when seek past the end of stream

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      Currently AbfsInputStream#seek has below check:

      public synchronized void seek(long n) throws IOException {
      ...
      if (n > contentLength) {
       throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF);
      }
      ...
      }
      

      So if a the seek is called with a position past the end of the stream, a EOFException gets thrown. However, it appears to me this behavior is different from some other inputstream impls, such as S3AInputStream and LocalFSFileInputStream, where seek passing the end is allowed, only that a later read call will return -1 indicating EOF. I think it would be better to have AbfsInputStream do the same thing.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            abhishekd Abhishek Das Assign to me
            vagarychen Chen Liang

            Dates

              Created:
              Updated:

              Slack

                Issue deployment