[
https://issues.apache.org/jira/browse/HBASE-16699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15517954#comment-15517954
]
huaxiang sun commented on HBASE-16699:
--------------------------------------
Testing code to explore the issue.
{code}
class MyEnvironmentEdge implements EnvironmentEdge {
private long count = 0;
@Override public long currentTime() {
return 500 * (++count);
}
}
@Test
public void testOverflow() throws InterruptedException {
EnvironmentEdgeManager.injectEdge(new MyEnvironmentEdge());
RateLimiter limiter = new AverageIntervalRateLimiter();
long limit = Long.MAX_VALUE;
limiter.set(limit, TimeUnit.SECONDS);
assertEquals(limit, limiter.getAvailable());
assertTrue(limiter.canExecute(limit / 2));
limiter.consume(limit / 2);
// after 500 millseconds, refill should return limit /2
assertTrue(limiter.canExecute(limit / 2 + 2));
EnvironmentEdgeManager.reset();
}
{code}
> Overflows in AverageIntervalRateLimiter's refill() and getWaitInterval()
> ------------------------------------------------------------------------
>
> Key: HBASE-16699
> URL: https://issues.apache.org/jira/browse/HBASE-16699
> Project: HBase
> Issue Type: Bug
> Affects Versions: 2.0.0, 1.4.0
> Reporter: huaxiang sun
> Assignee: huaxiang sun
>
> Please see the following two lines. Once it overflows, it will cause wrong
> behavior. For unconfigured RateLimiters, we should have simpler logic to
> byPass the check.
> https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/AverageIntervalRateLimiter.java#L37
> https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/AverageIntervalRateLimiter.java#L51
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)