[ https://issues.apache.org/jira/browse/HBASE-24615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17158810#comment-17158810 ]
Guanghao Zhang commented on HBASE-24615: ---------------------------------------- {quote}The snippet you shared is for overflow bucket (for the count that falls outside of ranges[length-1]) In this jira we fixed the case where we are not updating the count between the range: ranges[length-2] and ranges[length-1] {quote} Got it. +1 for branch-2.2. Let me cherry-pick it. > MutableRangeHistogram#updateSnapshotRangeMetrics doesn't calculate the > distribution for last bucket. > ---------------------------------------------------------------------------------------------------- > > Key: HBASE-24615 > URL: https://issues.apache.org/jira/browse/HBASE-24615 > Project: HBase > Issue Type: Bug > Components: metrics > Affects Versions: 2.3.0, master, 1.3.7, 2.2.6 > Reporter: Rushabh Shah > Assignee: wenfeiyi666 > Priority: Major > Fix For: 3.0.0-alpha-1, 2.3.1, 1.7.0, 2.4.0 > > > We are not processing the distribution for last bucket. > https://github.com/apache/hbase/blob/master/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java#L70 > {code:java} > public void updateSnapshotRangeMetrics(MetricsRecordBuilder > metricsRecordBuilder, > Snapshot snapshot) { > long priorRange = 0; > long cumNum = 0; > final long[] ranges = getRanges(); > final String rangeType = getRangeType(); > for (int i = 0; i < ranges.length - 1; i++) { -----> The bug lies > here. We are not processing last bucket. > long val = snapshot.getCountAtOrBelow(ranges[i]); > if (val - cumNum > 0) { > metricsRecordBuilder.addCounter( > Interns.info(name + "_" + rangeType + "_" + priorRange + "-" + > ranges[i], desc), > val - cumNum); > } > priorRange = ranges[i]; > cumNum = val; > } > long val = snapshot.getCount(); > if (val - cumNum > 0) { > metricsRecordBuilder.addCounter( > Interns.info(name + "_" + rangeType + "_" + ranges[ranges.length - > 1] + "-inf", desc), > val - cumNum); > } > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)