hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikael Sitruk <mikael.sit...@gmail.com>
Subject Re: question regarding code
Date Thu, 29 Dec 2011 10:38:13 GMT
NP I'll fill it
On Dec 29, 2011 10:52 AM, "Harsh J" <harsh@cloudera.com> wrote:

> 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<byte [], Long> regionsToSeqids) {
> >    //  This method is static so it can be unit tested the easier.
> >    List<byte []> regions = null;
> >    for (Map.Entry<byte [], Long> e: regionsToSeqids.entrySet()) {
> >      if (e.getValue().longValue() <= oldestWALseqid) {
> >        if (regions == null) regions = new ArrayList<byte []>();
> >        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<byte [], Long> regionsToSeqids) {
> >    //  This method is static so it can be unit tested the easier.
> >    List<byte []> regions = new ArrayList<byte []>();
> >    for (Map.Entry<byte [], Long> e: regionsToSeqids.entrySet()) {
> >      if (e.getValue().longValue() <= oldestWALseqid) {
> >        //if (regions == null) regions = new ArrayList<byte []>();
> >        regions.add(e.getKey());
> >      }
> >    }
> >    return regions.size() == 0?
> >      null: regions.toArray(new byte [][] {HConstants.EMPTY_BYTE_ARRAY});
> >  }
> >
> > regards,
> >
> > Mikael.S
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message