hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anoop Sam John (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-14550) Short circuit checks in ByteBufferUtils compare/equals
Date Sat, 17 Oct 2015 05:31:05 GMT

    [ https://issues.apache.org/jira/browse/HBASE-14550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14961756#comment-14961756

Anoop Sam John commented on HBASE-14550:

It is a nice to have.. In Bytes.java  we can see short circuit checks in compare/equals methods
public static boolean equals(final byte[] left, int leftOffset, int leftLen,
                               final byte[] right, int rightOffset, int rightLen) {
    // short circuit case
    if (left == right &&
        leftOffset == rightOffset &&
        leftLen == rightLen) {
      return true;

I saw another issue being raised (forgot id) which says to add short circuit check for same
cells in CellComparator compare methods..  It says we call the method with same objects some
times..  Am not sure how/why..  Asked a Q there...   If such things happen in some way, the
Bytes check would have helped us..  But in BBUtils  it will just do all bytes checks!!

So what do you think?  IMO we should check why we call compare with same Cells.. May be that
is some thing we can not avoid?  If so add the short circuit is a must..  Again that will
be best to add in CellComparator.    But for equals method also it might be necessary..  So
CellUtil equals?

Just raised it as a tracker..   We can do the above  in that old jira..  

> Short circuit checks in ByteBufferUtils compare/equals
> ------------------------------------------------------
>                 Key: HBASE-14550
>                 URL: https://issues.apache.org/jira/browse/HBASE-14550
>             Project: HBase
>          Issue Type: Sub-task
>          Components: regionserver, Scanners
>            Reporter: Anoop Sam John
>            Assignee: Anoop Sam John

This message was sent by Atlassian JIRA

View raw message