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

Shibin Zhang updated HBASE-18568:
---------------------------------
    Description: 
i found the value of  metric numReigons in Regions is not correct.
the metric can not add or remove  region correctly as region  close or open.
the metric  as follow:

"name" : "Hadoop:service=HBase,name=RegionServer,sub=Regions",
"numRegions" : 2,

after trouble shooting ,i found the reason is in 
MetricsRegionSourceImpl#MetricsRegionSourceImpl 

{code:java}
agg.register(this);
...
hashCode = regionWrapper.getRegionHashCode();
{code}


when add the MetricsRegionSource to set ,but the hashCode has not yet 
initialized.
So, the setFromMap can put or remove the object correctly. 
it will be better like this :

{code:java}
hashCode = regionWrapper.getRegionHashCode();
agg.register(this);
{code}



  was:
i found the value of  metric numReigons in Regions is not correct.
the metric can not add or remove  region correctly as region  close or open.
the metric  as follow:

"name" : "Hadoop:service=HBase,name=RegionServer,sub=Regions",
"numRegions" : 2,

after trouble shooting ,i found the reason is in 
{code:java}
MetricsRegionSourceImpl#MetricsRegionSourceImpl 
{code}



{code:java}
agg.register(this);
...
hashCode = regionWrapper.getRegionHashCode();
{code}


when add the MetricsRegionSource to set ,but the hashCode has not yet 
initialized.
So, the setFromMap can put or remove the object correctly. 
it will be better like this :

{code:java}
hashCode = regionWrapper.getRegionHashCode();
agg.register(this);
{code}




> Correct  Regions metric of  numRegions
> --------------------------------------
>
>                 Key: HBASE-18568
>                 URL: https://issues.apache.org/jira/browse/HBASE-18568
>             Project: HBase
>          Issue Type: Bug
>          Components: metrics
>    Affects Versions: 3.0.0
>            Reporter: Shibin Zhang
>            Assignee: Shibin Zhang
>            Priority: Critical
>
> i found the value of  metric numReigons in Regions is not correct.
> the metric can not add or remove  region correctly as region  close or open.
> the metric  as follow:
> "name" : "Hadoop:service=HBase,name=RegionServer,sub=Regions",
> "numRegions" : 2,
> after trouble shooting ,i found the reason is in 
> MetricsRegionSourceImpl#MetricsRegionSourceImpl 
> {code:java}
> agg.register(this);
> ...
> hashCode = regionWrapper.getRegionHashCode();
> {code}
> when add the MetricsRegionSource to set ,but the hashCode has not yet 
> initialized.
> So, the setFromMap can put or remove the object correctly. 
> it will be better like this :
> {code:java}
> hashCode = regionWrapper.getRegionHashCode();
> agg.register(this);
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to