[
https://issues.apache.org/jira/browse/HADOOP-10047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13795446#comment-13795446
]
Chris Nauroth commented on HADOOP-10047:
----------------------------------------
Thanks for filing this, [~gopalv]. From the Javadocs, it looks like you
prototyped this for the zlib compressor and decompressor. When you get a
chance, it would be nice if you could post that so we can get a sense for what
this looks like in implementing classes, even if it's not a final patch.
One of our goals in HDFS-5191 was to achieve an API that didn't require the
caller to write different code for direct vs. non-direct. Unfortunately, I
don't see a way to achieve that here. In the input streams, we had the
advantage of an abstract base class where we could put a default fallback
copying implementation. {{Compressor}} and {{Decompressor}} are interfaces, so
we can't put in a default implementation, and we also can't add the new methods
without breaking backwards-compatibility. It seems inevitable that callers
will have to downcast to {{DirectCompressor}}/{{DirectDecompressor}}. I don't
see another way.
> Allow Compressor/Decompressor APIs to expose a Direct ByteBuffer API
> --------------------------------------------------------------------
>
> Key: HADOOP-10047
> URL: https://issues.apache.org/jira/browse/HADOOP-10047
> Project: Hadoop Common
> Issue Type: New Feature
> Components: io
> Reporter: Gopal V
> Assignee: Gopal V
> Labels: compression
> Attachments: DirectCompressor.html, DirectDecompressor.html
>
>
> With the Zero-Copy reads in HDFS (HDFS-5260), it becomes important to perform
> all I/O operations without copying data into byte[] buffers or other buffers
> which wrap over them.
> This is a proposal for adding new DirectCompressor and DirectDecompressor
> interfaces to the io.compress, to indicate codecs which want to surface the
> direct buffer layer upwards.
> The implementation may or may not copy the buffers passed in, but should work
> with direct heap/mmap buffers and cannot assume .array() availability.
--
This message was sent by Atlassian JIRA
(v6.1#6144)