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 D68C6200B9A for ; Fri, 23 Sep 2016 07:09:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D522E160AAD; Fri, 23 Sep 2016 05:09:22 +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 2C387160AE0 for ; Fri, 23 Sep 2016 07:09:22 +0200 (CEST) Received: (qmail 64251 invoked by uid 500); 23 Sep 2016 05:09:21 -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 63901 invoked by uid 99); 23 Sep 2016 05:09:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2016 05:09:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id B318B2C2A67 for ; Fri, 23 Sep 2016 05:09:20 +0000 (UTC) Date: Fri, 23 Sep 2016 05:09:20 +0000 (UTC) From: "ramkrishna.s.vasudevan (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HBASE-16643) Reverse scanner heap creation may not allow MSLAB closure due to improper ref counting of segments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 23 Sep 2016 05:09:23 -0000 [ https://issues.apache.org/jira/browse/HBASE-16643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] ramkrishna.s.vasudevan updated HBASE-16643: ------------------------------------------- Attachment: HBASE-16643_5.patch Updated patch based on RB comments. I have left some replies in the RB for all the comments and questions. The SegmentScanner change is needed is what I believe. If that is not needed in this JIRA I can remove it and raise another JIRA for discussion. > Reverse scanner heap creation may not allow MSLAB closure due to improper ref counting of segments > -------------------------------------------------------------------------------------------------- > > Key: HBASE-16643 > URL: https://issues.apache.org/jira/browse/HBASE-16643 > Project: HBase > Issue Type: Bug > Reporter: ramkrishna.s.vasudevan > Assignee: ramkrishna.s.vasudevan > Priority: Critical > Fix For: 2.0.0 > > Attachments: HBASE-16643.patch, HBASE-16643_1.patch, HBASE-16643_2.patch, HBASE-16643_3.patch, HBASE-16643_4.patch, HBASE-16643_5.patch > > > In the reverse scanner case, > While doing 'initBackwardHeapIfNeeded' in MemstoreScanner for setting the backward heap, we do a > {code} > if ((backwardHeap == null) && (forwardHeap != null)) { > forwardHeap.close(); > forwardHeap = null; > // before building the heap seek for the relevant key on the scanners, > // for the heap to be built from the scanners correctly > for (KeyValueScanner scan : scanners) { > if (toLast) { > res |= scan.seekToLastRow(); > } else { > res |= scan.backwardSeek(cell); > } > } > {code} > forwardHeap.close(). This would internally decrement the MSLAB ref counter for the current active segment and snapshot segment. > When the scan is actually closed again we do close() and that will again decrement the count. Here chances are there that the count would go negative and hence the actual MSLAB closure that checks for refCount==0 will fail. Apart from this, when the refCount becomes 0 after the firstClose if any other thread requests to close the segment, then we will end up in corrupted segment because the segment could be put back to the MSLAB pool. -- This message was sent by Atlassian JIRA (v6.3.4#6332)