Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 57A6A200C6B for ; Tue, 2 May 2017 08:33:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5646F160BAC; Tue, 2 May 2017 06:33:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9BCAC160BA1 for ; Tue, 2 May 2017 08:33:08 +0200 (CEST) Received: (qmail 33622 invoked by uid 500); 2 May 2017 06:33:07 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 33610 invoked by uid 99); 2 May 2017 06:33:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 May 2017 06:33:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 4F96B1AFC58 for ; Tue, 2 May 2017 06:33:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id cm4Qc9lrg0y0 for ; Tue, 2 May 2017 06:33:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 5DFA45F659 for ; Tue, 2 May 2017 06:33:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 91DFCE06CF for ; Tue, 2 May 2017 06:33:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4990821DE4 for ; Tue, 2 May 2017 06:33:04 +0000 (UTC) Date: Tue, 2 May 2017 06:33:04 +0000 (UTC) From: "Anoop Sam John (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HBASE-17874) Limiting of read request response size based on block size may go wrong when blocks are read from onheap or off heap bucket cache MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 02 May 2017 06:33:09 -0000 [ https://issues.apache.org/jira/browse/HBASE-17874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Anoop Sam John updated HBASE-17874: ----------------------------------- Attachment: HBASE-17874.patch > Limiting of read request response size based on block size may go wrong when blocks are read from onheap or off heap bucket cache > --------------------------------------------------------------------------------------------------------------------------------- > > Key: HBASE-17874 > URL: https://issues.apache.org/jira/browse/HBASE-17874 > Project: HBase > Issue Type: Bug > Affects Versions: 2.0.0 > Reporter: Anoop Sam John > Assignee: Anoop Sam John > Priority: Blocker > Fix For: 2.0.0 > > Attachments: HBASE-17874.patch > > > HBASE-14978 added this size limiting so as to make sure the multi read requests do not retain two many blocks. This works well when the blocks are obtained from any where other than memory mode BucketCache. In case of on heap or off heap Bucket Cache, the entire cache area is split into N ByteBuffers each of size 4 MB. When we hit a block in this cache, we no longer do copy data into temp array. We use the same shared memory (BB). Its capacity is 4 MB. > The block size accounting logic is RSRpcServices is like below > {code} > if (c instanceof ByteBufferCell) { > ByteBufferCell bbCell = (ByteBufferCell) c; > ByteBuffer bb = bbCell.getValueByteBuffer(); > if (bb != lastBlock) { > context.incrementResponseBlockSize(bb.capacity()); > lastBlock = bb; > } > } else { > // We're using the last block being the same as the current block as > // a proxy for pointing to a new block. This won't be exact. > // If there are multiple gets that bounce back and forth > // Then it's possible that this will over count the size of > // referenced blocks. However it's better to over count and > // use two rpcs than to OOME the regionserver. > byte[] valueArray = c.getValueArray(); > if (valueArray != lastBlock) { > context.incrementResponseBlockSize(valueArray.length); > lastBlock = valueArray; > } > } > {code} > We take the BBCell's value buffer and takes its capacity. The cell is backed by the same BB that backs the HFileBlock. When the HFileBlock is created from the BC, we do as below duplicating and proper positioning and limiting the BB > {code} > ByteBuffer bb = buffers[i].duplicate(); > if (i == startBuffer) { > cnt = bufferSize - startBufferOffset; > if (cnt > len) cnt = len; > bb.limit(startBufferOffset + cnt).position(startBufferOffset); > {code} > Still this BB's capacity is 4 MB. > This will make the size limit breach to happen too soon. What we expect is block size defaults to 64 KB and so we here by allow cells from different blocks to appear in response. We have a way to check whether we move from one block to next. > {code} > if (bb != lastBlock) { > ... > lastBlock = bb; > } > {code} > But already just by considering the 1st cell, we added 4 MB size! -- This message was sent by Atlassian JIRA (v6.3.15#6346)