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 EBCF1200B16 for ; Mon, 20 Jun 2016 19:26:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EA933160A26; Mon, 20 Jun 2016 17:26:07 +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 471A6160A66 for ; Mon, 20 Jun 2016 19:26:07 +0200 (CEST) Received: (qmail 92079 invoked by uid 500); 20 Jun 2016 17:26:06 -0000 Mailing-List: contact yarn-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list yarn-issues@hadoop.apache.org Received: (qmail 91819 invoked by uid 99); 20 Jun 2016 17:26:05 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2016 17:26:05 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id DD7DE2C1F60 for ; Mon, 20 Jun 2016 17:26:05 +0000 (UTC) Date: Mon, 20 Jun 2016 17:26:05 +0000 (UTC) From: "Joep Rottinghuis (JIRA)" To: yarn-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (YARN-5260) Review / Recommendations for hbase writer code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 20 Jun 2016 17:26:08 -0000 [ https://issues.apache.org/jira/browse/YARN-5260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15339965#comment-15339965 ] Joep Rottinghuis commented on YARN-5260: ---------------------------------------- InternalScanner is now tagged with LimitedPrivate(HBaseInterfaceAudience.COPROC) as of HBase 1.3.0 and up as per HBASE-16048 > Review / Recommendations for hbase writer code > ---------------------------------------------- > > Key: YARN-5260 > URL: https://issues.apache.org/jira/browse/YARN-5260 > Project: Hadoop YARN > Issue Type: Sub-task > Components: timelineserver > Reporter: Vrushali C > Assignee: Vrushali C > > [~ted_yu] is graciously reviewing the hbase writer related code and has some recommendations. (more to come as review progresses). I will keep track of those in this jira and perhaps spin off other jira(s) depending on the scope of changes. > For FlowRunCoprocessor.java : > > - private HRegion region; > Try to declare as Region - the interface. This way, you are to call methods that are stable across future releases. > - private long getCellTimestamp(long timestamp, List tags) { > tags is not used, remove the parameter. > For FlowScanner: > - private final InternalScanner flowRunScanner; > Currently InternalScanner is Private. If you must use it, try surfacing your case to hbase so that it can be marked: > @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) > @InterfaceStability.Evolving > w.r.t. regionScanner : > {code} > if (internalScanner instanceof RegionScanner) { > this.regionScanner = (RegionScanner) internalScanner; > } > {code} > I see IllegalStateException being thrown in some methods when regionScanner is null. Better bail out early in the ctor. > {code} > public static AggregationOperation getAggregationOperationFromTagsList( > List tags) { > for (AggregationOperation aggOp : AggregationOperation.values()) { > for (Tag tag : tags) { > if (tag.getType() == aggOp.getTagType()) { > return aggOp; > {code} > The above nested loop can be improved (a lot): > values() returns an array. If you pre-generate a Set (https://docs.oracle.com/javase/7/docs/api/java/util/EnumSet.html) containing all the values, the outer loop can be omitted. > You iterate through tags and see if tag.getType() is in the Set. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: yarn-issues-help@hadoop.apache.org