hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jing Zhao (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HDFS-7825) HdfsDataInputStream::read(ByteBuffer) method doesn't conform to its API
Date Tue, 24 Feb 2015 00:05:12 GMT

     [ https://issues.apache.org/jira/browse/HDFS-7825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jing Zhao resolved HDFS-7825.
-----------------------------
    Resolution: Duplicate

Duplicated with HADOOP-11039

> HdfsDataInputStream::read(ByteBuffer) method doesn't conform to its API
> -----------------------------------------------------------------------
>
>                 Key: HDFS-7825
>                 URL: https://issues.apache.org/jira/browse/HDFS-7825
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Sergey Shelukhin
>
> ByteBufferReadable::read(ByteBuffer) javadoc says:
> {noformat}
> After a successful call, buf.position() and buf.limit() should be unchanged, and therefore
any data can be immediately read from buf. buf.mark() may be cleared or updated. 
> {noformat}
> I have the following code: 
> {noformat}
>         ByteBuffer directBuf = ByteBuffer.allocateDirect(len);
>         int pos = directBuf.position();
>             int count = file.read(directBuf);
>             if (count < 0) throw new EOFException();
>             if (directBuf.position() != pos) {
>               RecordReaderImpl.LOG.info("Warning - position mismatch from " + file.getClass()
>                   + ": after reading " + count + ", expected " + pos + " but got " +
directBuf.position());
>             }
> {noformat}
> and I get:
> {noformat}
> 15/02/23 15:30:56 [pool-4-thread-1] INFO orc.RecordReaderImpl : Warning - position mismatch
from class org.apache.hadoop.hdfs.client.HdfsDataInputStream: after reading 6, expected 0
but got 6
> {noformat}
> So the position is changed, unlike the API doc indicates.
> Also, while I haven't verified yet, it may be that the 0-length read is not handled properly.



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

Mime
View raw message