Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AEF69B43 for ; Fri, 30 Dec 2011 19:16:47 +0000 (UTC) Received: (qmail 42779 invoked by uid 500); 30 Dec 2011 19:16:46 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 42653 invoked by uid 500); 30 Dec 2011 19:16:46 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Received: (qmail 42645 invoked by uid 99); 30 Dec 2011 19:16:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Dec 2011 19:16:46 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mikael.sitruk@gmail.com designates 209.85.215.41 as permitted sender) Received: from [209.85.215.41] (HELO mail-lpp01m010-f41.google.com) (209.85.215.41) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Dec 2011 19:16:40 +0000 Received: by lagv3 with SMTP id v3so4689164lag.14 for ; Fri, 30 Dec 2011 11:16:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=zR+EAVIF+TupiuAul+9w3NlaEdqtcJzocIg/3OymKSI=; b=MGeMLGpsIEdLh0urcuIMB1XgOhxfJhXeeyvo60U9X1BNQDHAlMHxLKu21S+ef/oh4i JANEhlotHCqAkQUaR0ZTY2shjnf5mTlEX86wj0vuLq++XwdHdRuEj9qgpOP+ODy9nrxz THC+9Z4dkUpgEFTZ9y7qlZbwH4MOPR2wkf5YA= MIME-Version: 1.0 Received: by 10.152.111.7 with SMTP id ie7mr32588047lab.11.1325272577492; Fri, 30 Dec 2011 11:16:17 -0800 (PST) Received: by 10.152.10.129 with HTTP; Fri, 30 Dec 2011 11:16:17 -0800 (PST) In-Reply-To: References: <4fyd04yalgmalxdk8l5uy648.1325219660505@email.android.com> Date: Fri, 30 Dec 2011 21:16:17 +0200 Message-ID: Subject: Re: question regarding code From: Mikael Sitruk To: dev@hbase.apache.org Content-Type: multipart/alternative; boundary=f46d04083a6936485804b554113c --f46d04083a6936485804b554113c Content-Type: text/plain; charset=UTF-8 it should not be a problem i'll try Mikael.S On Fri, Dec 30, 2011 at 9:10 PM, wrote: > Mikael: > Can you upload a patch ? > > Thanks > > > > On Dec 30, 2011, at 11:06 AM, Mikael Sitruk > wrote: > > > Thanks to all of you, jira - > > HBASE-5110 (code > > enhancement - remove unnecessary if-checks in every loop in HLog class) > > > > Happy new year for all of you. > > > > Mikael.S > > > > On Fri, Dec 30, 2011 at 6:34 AM, Lars H wrote: > > > >> oh no no... please file a jira and help us make HBase better. > >> > >> Mikael Sitruk schrieb: > >> > >>> Lars hi > >>> > >>> This method will be called anytime that old log exist and might be > cleaned > >>> (HLog.cleanOldsLogs()) and there are too much logs. > >>> It is called from LogRoller thread, Hlog creation, and > >> metaUtils.shutdown() > >>> (code in 0.90.1 - also present at least in those classes in trunk), > >>> The creation of Arraylist is approx 24 bytes (8 for Arraylist object, > 12 > >>> for the array member and 4 for the int member) if I didn't forgot > >>> something, nevertheless the "if" will not be checked for each region > >> having > >>> an older log file (which will occurs a lot if you have heavy writes > >>> scenarios). > >>> This is true that this will create garbage (in case it will not be > used) > >>> but this is a short lived object, it will be collected immediately > with a > >>> minor garbage collection. It would have be more problematic if the > object > >>> was long lived. > >>> > >>> Anyway you are the one to decide, if you accept a jira, i will open > one, > >>> just let me know. > >>> > >>> Regards, > >>> Mikael.S > >>> > >>> > >>> On Thu, Dec 29, 2011 at 6:54 PM, lars hofhansl > >> wrote: > >>> > >>>> The only downside is that the ArrayList now is always created, even if > >> it > >>>> is not needed, thereby producing unnecessary garbage. > >>>> I have not bearing how frequently we'll get here and find no relevant > >>>> regions, though. > >>>> > >>>> > >>>> -- Lars > >>>> > >>>> > >>>> ----- Original Message ----- > >>>> From: Harsh J > >>>> To: dev@hbase.apache.org > >>>> Cc: > >>>> Sent: Thursday, December 29, 2011 12:51 AM > >>>> Subject: Re: question regarding code > >>>> > >>>> Yeah that'd work too. File a JIRA with the change? > >>>> > >>>> On 29-Dec-2011, at 2:12 PM, Mikael Sitruk wrote: > >>>> > >>>>> Hi all > >>>>> > >>>>> I have question on some code (taken from HLog) see below > >>>>> > >>>>> > >>>>> static byte [][] findMemstoresWithEditsEqualOrOlderThan(final long > >>>>> oldestWALseqid, > >>>>> final Map regionsToSeqids) { > >>>>> // This method is static so it can be unit tested the easier. > >>>>> List regions = null; > >>>>> for (Map.Entry e: regionsToSeqids.entrySet()) { > >>>>> if (e.getValue().longValue() <= oldestWALseqid) { > >>>>> if (regions == null) regions = new ArrayList(); > >>>>> regions.add(e.getKey()); > >>>>> } > >>>>> } > >>>>> return regions == null? > >>>>> null: regions.toArray(new byte [][] > >> {HConstants.EMPTY_BYTE_ARRAY}); > >>>>> } > >>>>> > >>>>> Shouldn't be better to remove the if in the loop doing as follow? > >>>>> > >>>>> static byte [][] findMemstoresWithEditsEqualOrOlderThan(final long > >>>>> oldestWALseqid, > >>>>> final Map regionsToSeqids) { > >>>>> // This method is static so it can be unit tested the easier. > >>>>> List regions = new ArrayList(); > >>>>> for (Map.Entry e: regionsToSeqids.entrySet()) { > >>>>> if (e.getValue().longValue() <= oldestWALseqid) { > >>>>> //if (regions == null) regions = new ArrayList(); > >>>>> regions.add(e.getKey()); > >>>>> } > >>>>> } > >>>>> return regions.size() == 0? > >>>>> null: regions.toArray(new byte [][] > >> {HConstants.EMPTY_BYTE_ARRAY}); > >>>>> } > >>>>> > >>>>> regards, > >>>>> > >>>>> Mikael.S > >>>> > >>> > >>> > >>> > >>> -- > >>> Mikael.S > >> > > > > > > > > -- > > Mikael.S > -- Mikael.S --f46d04083a6936485804b554113c--