[
https://issues.apache.org/jira/browse/HDFS-5191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13776619#comment-13776619
]
Chris Nauroth commented on HDFS-5191:
-------------------------------------
I forgot one more thing. There is still an {{UnsupportedOperationException}}
thrown in the "fallback fallback" case. The reason is that in
{{ByteBufferUtil#fallbackRead}}, the {{stream}} argument can be an
{{FSDataInputStream}}. This class implements {{ByteBufferReadable}}, so the
calculation of {{useDirect}} is always true, even if the underlying stream
inside the {{FSDataInputStream}} doesn't support it.
Here is a potential change that fixes it. With this in place, we fall through
to the array-copying code path, and I don't see the
{{UnsupportedOperationException}}. Colin, do you want to incorporate this into
the patch (or something like it)?
{code}
final boolean useDirect;
if (stream instanceof FSDataInputStream) {
FSDataInputStream fsdis = (FSDataInputStream)stream;
useDirect = fsdis.getWrappedStream() instanceof ByteBufferReadable;
} else {
useDirect = stream instanceof ByteBufferReadable;
}
{code}
> revisit zero-copy API in FSDataInputStream to make it more intuitive
> --------------------------------------------------------------------
>
> Key: HDFS-5191
> URL: https://issues.apache.org/jira/browse/HDFS-5191
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: hdfs-client, libhdfs
> Affects Versions: HDFS-4949
> Reporter: Colin Patrick McCabe
> Assignee: Colin Patrick McCabe
> Attachments: HDFS-5191-caching.001.patch,
> HDFS-5191-caching.003.patch, HDFS-5191-caching.006.patch,
> HDFS-5191-caching.007.patch, HDFS-5191-caching.008.patch,
> HDFS-5191-caching.009.patch
>
>
> As per the discussion on HDFS-4953, we should revisit the zero-copy API to
> make it more intuitive for new users.
--
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