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

Rushabh Shah commented on HBASE-25052:
--------------------------------------

> Rushabh Shah you can provide higher bound of region with constructor.

Thank you [~vjasani] ! I understand the fix. But the same tests were passing in 
branch-1.3 and now failing in branch-1.6.
At my dayjob, I extended MutableRangeHistogram (MutableSizeHistogram and 
MutableTimeHistogram) in [Phoenix|https://github.com/apache/phoenix] project 
and created some histogram metrics. It is still in our internal repo (haven't 
open sourced yet but plan to do it shortly). I wrote some tests for that which 
were running fine in branch-1.3 but now once we upgraded to branch-1.6 it 
started failing.

Also MutableTimeHistogram doesn't expose any constructor to pass in maxExpected 
value. 
[MutableTimeHistogram|https://github.com/apache/hbase/blob/master/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableTimeHistogram.java#L37]
 calls 
[MutableRangeHistogram|https://github.com/apache/hbase/blob/master/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java#L38]
 which in turn calls 
[MutableHistogram|https://github.com/apache/hbase/blob/master/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java#L47]
 which calls empty constructor HistogramImpl. 
Also due to many other limitations of FastLongHistogram, internally we decided 
to move to [HdrHistogram|https://github.com/HdrHistogram/HdrHistogram] so this 
is not a pressing issue for me personally but good to evaluate other hbase 
histogram metrics after the change.

> FastLongHistogram#getCountAtOrBelow method is broken.
> -----------------------------------------------------
>
>                 Key: HBASE-25052
>                 URL: https://issues.apache.org/jira/browse/HBASE-25052
>             Project: HBase
>          Issue Type: Bug
>          Components: metrics
>    Affects Versions: 3.0.0-alpha-1, 2.3.0, 1.6.0, 2.2.3
>            Reporter: Rushabh Shah
>            Priority: Major
>
> FastLongHistogram#getCountAtOrBelow method is broken.
> If I revert HBASE-23245 then it works fine.
> Wrote a small test case in TestHistogramImpl.java : 
> {code:java}
>   @Test
>   public void testAdd1() {
>     HistogramImpl histogram = new HistogramImpl();
>     for (int i = 0; i < 100; i++) {
>       histogram.update(i);
>     }
>     Snapshot snapshot = histogram.snapshot();
>     // This should return count as 6 since we added 0, 1, 2, 3, 4, 5
>     Assert.assertEquals(6, snapshot.getCountAtOrBelow(5));
> {code}
> It fails as below:
> java.lang.AssertionError: 
> Expected :6
> Actual      :100



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to