Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 42DC9F5E2 for ; Mon, 15 Apr 2013 21:02:17 +0000 (UTC) Received: (qmail 80622 invoked by uid 500); 15 Apr 2013 21:02:17 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 80568 invoked by uid 500); 15 Apr 2013 21:02:17 -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 80558 invoked by uid 99); 15 Apr 2013 21:02:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Apr 2013 21:02:16 +0000 Date: Mon, 15 Apr 2013 21:02:16 +0000 (UTC) From: "Sergey Shelukhin (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-8340) WAL compression handling of seeks seems to be either inefficient or incorrect MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-8340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13632184#comment-13632184 ] Sergey Shelukhin commented on HBASE-8340: ----------------------------------------- According to next(), it will be set to false after any next(), so if seek is done after next(), or after previous seek it will be already false. > WAL compression handling of seeks seems to be either inefficient or incorrect > ----------------------------------------------------------------------------- > > Key: HBASE-8340 > URL: https://issues.apache.org/jira/browse/HBASE-8340 > Project: HBase > Issue Type: Bug > Reporter: Sergey Shelukhin > > In next(...): > {code} > if (compressionContext != null && emptyCompressionContext) { > emptyCompressionContext = false; > } > return ... > {code} > > In seek() > {code} > if (compressionContext != null && emptyCompressionContext) { > while (next() != null) { > if (getPosition() == pos) { > emptyCompressionContext = false; > break; > } > } > ... > reader.seek(pos); > {code} > So, seek will seek the file directly if either any next, or any seek, has been called before. > I am not sure what this code is for, but my best guess is that it is to populate the dictionary for compression. > If it is so, it would seem that one next() call (or even one seek() call) would not be enough, and seek must always use next(), otherwise it is incorrect. > If we assume that one next() is enough to be able to use reader.seek, as the current code would seem to imply, then there's no need for the first seek to call next() in a loop - it can call next once and then do reader.seek. > Note: even in case if all of this works fine because external usage creates the object and does one seek before any next-s, and no seeks after (the only bug-free pattern currently possible with both methods used if I'm not mistaken), then the code needs to be tightened and bug potential removed. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira