hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiroshi Ikeda (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-14873) Problems around BoundedByteBufferPool providing direct buffers
Date Thu, 26 Nov 2015 14:24:11 GMT

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

Hiroshi Ikeda updated HBASE-14873:
----------------------------------
    Attachment: HBASE-14873.patch

Just creating a proper test for the bugs is not easy. The root of the problems is handling
raw ByteByffer instances which should be returned to the pool, and we should create a more
abstract class and make the codebase use it.

I was not sure whether such class can be created, but after some trials and errors I think
I did it...But that is not so trivial change.

Added a patch.

I created a new class GatheringBuffer, which automatically retrieves buffers from the pool
if needed, and cooperates with GatheringByteChannel. I added more restriction to the size
of data given IPCUtil.buildCellBlock because strictly handling overflows in RpcServer is quite
stupid and annoying. For now the threshold size is Integer.MAX_VALUE / 16, and I hope it is
enough small for data conversions.

> 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
>         Attachments: 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