[ 
https://issues.apache.org/jira/browse/HBASE-20932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mingliang Liu updated HBASE-20932:
----------------------------------
    Description: 
After HBASE-20411 we have
{code:java|title=MemStoreSize::hashCode()}
  @Override
  public int hashCode() {
    long h = 31 * this.dataSize;
    h = h + 31 * this.heapSize;
    h = h + 31 * this.offHeapSize;
    return (int) h;
  }
 {code}
This is not effective {{hashCode()}} implementation. Instead we can use:
{code:java|title=MemStoreSize::hashCode()}
  @Override
  public int hashCode() {
    long h = this.dataSize;
    h = h * 31 + this.heapSize;
    h = h * 31 + this.offHeapSize;
    return (int) h;
  }
 {code}

  was:
After [HBASE-20411] we have
{code:title=MemStoreSize::hashCode()}
  @Override
  public int hashCode() {
    long h = 31 * this.dataSize;
    h = h + 31 * this.heapSize;
    h = h + 31 * this.offHeapSize;
    return (int) h;
  }
 {code}

This is not effective {{hashCode()}} implementation. Instead we can use:
{code:title=MemStoreSize::hashCode()}
  @Override
  public int hashCode() {
    long h = 31 * this.dataSize;
    h = h * 31 + this.heapSize;
    h = h * 31 + this.offHeapSize;
    return (int) h;
  }
 {code}


> Effective MemStoreSize::hashCode() 
> -----------------------------------
>
>                 Key: HBASE-20932
>                 URL: https://issues.apache.org/jira/browse/HBASE-20932
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 2.0.2
>            Reporter: Mingliang Liu
>            Priority: Major
>
> After HBASE-20411 we have
> {code:java|title=MemStoreSize::hashCode()}
>   @Override
>   public int hashCode() {
>     long h = 31 * this.dataSize;
>     h = h + 31 * this.heapSize;
>     h = h + 31 * this.offHeapSize;
>     return (int) h;
>   }
>  {code}
> This is not effective {{hashCode()}} implementation. Instead we can use:
> {code:java|title=MemStoreSize::hashCode()}
>   @Override
>   public int hashCode() {
>     long h = this.dataSize;
>     h = h * 31 + this.heapSize;
>     h = h * 31 + this.offHeapSize;
>     return (int) h;
>   }
>  {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to