hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-14873) Problems around BoundedByteBufferPool providing direct buffers
Date Wed, 02 Dec 2015 21:00:12 GMT

    [ https://issues.apache.org/jira/browse/HBASE-14873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15036612#comment-15036612
] 

stack commented on HBASE-14873:
-------------------------------

bq. To tell the truth I didn't expect to be agreed with the V2 path. 

Why sir? What is wrong with the approach especially if use BBUtil where we go to Unsafe if
applicable.

bq. BTW, once again, the Oracle implementation does a little more things than ByteBufferUtils.copyFromBufferToArray.

You have a point. What you reckon [~anoop.hbase]?

bq. . In other words there are situations where we should intentionally use the right buffer
in the right place.

Makes sense. I think the places where BBBP have been deployed so far make sense. The latest
instance, using them pulling request off the socket, is still TODO.

This issue that you filed is a dirty bug we need to fix regardless, right?

Thanks [~ikeda]



> Problems around BoundedByteBufferPool providing direct buffers
> --------------------------------------------------------------
>
>                 Key: HBASE-14873
>                 URL: https://issues.apache.org/jira/browse/HBASE-14873
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Hiroshi Ikeda
>            Assignee: Hiroshi Ikeda
>         Attachments: HBASE-14873-V2.patch, HBASE-14873.patch, HBASE-14873.patch, HBASE-14873.patch
>
>
> HBASE-13819 made BoundedByteBufferPool provide direct buffers.
> See RpcServer.java:
> {code}
> ...
> class Call implements RpcCallContext {
>   protected synchronized void setResponse(...) {
> ...
>     this.cellBlock = ipcUtil.buildCellBlock(..., reservoir);
> ...
>     bc = new BufferChain(..., this.cellBlock);
>     if (connection.useWrap) {
>       bc = wrapWithSasl(bc);
>     }
> ...
>   private BufferChain wrapWithSasl(BufferChain bc) throws IOException {
> ...
>     byte[] responseBytes = bc.getBytes();
> ...
> {code}
> {{cellBlock}} is expected to be a direct buffer retrieved from {{reservoir}} (but not
always), and {{bc}} may be composed of both direct and non-direct buffers.
> And then, see BufferChain.java:
> {code}
> byte [] getBytes() {
> ...
>     for (ByteBuffer bb: this.buffers) {
>       System.arraycopy(bb.array(), ...);
> {code}
> A direct buffer doesn't give its array, and will throw UnsupportedOperationException.
> Another problem; {{cellBlock}} is allowed to be a non-direct buffer, and after use it
will be put to {{reservoir}}, mixing direct and non-direct buffers in the pool.



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

Mime
View raw message