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

Zheng Hu commented on HBASE-22422:
----------------------------------

Here we should consider the unpacked block release if any prepareDecoding 
failure happen:
{code}
  HFileBlock unpack(HFileContext fileContext, FSReader reader) throws 
IOException {
    if (!fileContext.isCompressedOrEncrypted()) {
      // TODO: cannot use our own fileContext here because 
HFileBlock(ByteBuffer, boolean),
      // which is used for block serialization to L2 cache, does not preserve 
encoding and
      // encryption details.
      return this;
    }

    HFileBlock unpacked = new HFileBlock(this);
    unpacked.allocateBuffer(); // allocates space for the decompressed block

    HFileBlockDecodingContext ctx = blockType == BlockType.ENCODED_DATA
        ? reader.getBlockDecodingContext() : 
reader.getDefaultBlockDecodingContext();

    ByteBuff dup = this.buf.duplicate();
    dup.position(this.headerSize());
    dup = dup.slice();

    ctx.prepareDecoding(unpacked.getOnDiskSizeWithoutHeader(),
      unpacked.getUncompressedSizeWithoutHeader(), 
unpacked.getBufferWithoutHeader(true), dup);

    return unpacked;
  }
{code}

> Retain an ByteBuff with refCnt=0 when getBlock from LRUCache
> ------------------------------------------------------------
>
>                 Key: HBASE-22422
>                 URL: https://issues.apache.org/jira/browse/HBASE-22422
>             Project: HBase
>          Issue Type: Sub-task
>          Components: BlockCache
>            Reporter: Zheng Hu
>            Assignee: Zheng Hu
>            Priority: Major
>         Attachments: LRUBlockCache-getBlock.png, 
> image-2019-05-15-12-00-03-641.png
>
>
> After runing YCSB scan/get benchmark in our XiaoMi cluster,  we found the get 
> QPS dropped from  25000/s to hunderds per second in a cluster with five 
> nodes.  
> After enable the debug log at YCSB client side,  I found the following 
> stacktrace , see 
> https://issues.apache.org/jira/secure/attachment/12968745/image-2019-05-15-12-00-03-641.png
> Need a patch to fix this. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to