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

Hudson commented on HBASE-13888:
--------------------------------

SUCCESS: Integrated in HBase-1.1 #543 (See 
[https://builds.apache.org/job/HBase-1.1/543/])
HBASE-13888 Fix refill bug from HBASE-13686 (Guanghao Zhang) (tedyu: rev 
49700460dabf90562b6f9b4f1f5c45df98668c6c)
* hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestRateLimiter.java
* 
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/AverageIntervalRateLimiter.java
* 
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/FixedIntervalRateLimiter.java
* hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/RateLimiter.java


> Fix refill bug from HBASE-13686
> -------------------------------
>
>                 Key: HBASE-13888
>                 URL: https://issues.apache.org/jira/browse/HBASE-13888
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 2.0.0, 1.2.0, 1.1.1
>            Reporter: Guanghao Zhang
>            Assignee: Guanghao Zhang
>             Fix For: 2.0.0, 1.2.0, 1.1.2
>
>         Attachments: HBASE-13888-v1.patch, HBASE-13888-v2.patch, 
> HBASE-13888-v3.patch
>
>
> As I report the RateLimiter fail to limit in HBASE-13686, then [~ashish 
> singhi] fix that problem by support two kinds of RateLimiter:  
> AverageIntervalRateLimiter and FixedIntervalRateLimiter. But in my use of the 
> code, I found a new bug about refill() in AverageIntervalRateLimiter.
> {code}
>     long delta = (limit * (now - nextRefillTime)) / 
> super.getTimeUnitInMillis();
>     if (delta > 0) {
>       this.nextRefillTime = now;
>       return Math.min(limit, available + delta);
>     }   
> {code}
> When delta > 0, refill maybe return available + delta. Then in the 
> canExecute(), avail will add refillAmount again. So the new avail maybe 2 * 
> avail + delta.
> {code}
>     long refillAmount = refill(limit, avail);
>     if (refillAmount == 0 && avail < amount) {
>       return false;
>     }   
>     // check for positive overflow
>     if (avail <= Long.MAX_VALUE - refillAmount) {
>       avail = Math.max(0, Math.min(avail + refillAmount, limit));
>     } else {
>       avail = Math.max(0, limit);
>     } 
> {code}
> I will add more unit tests for RateLimiter in the next days.
> Review Board: https://reviews.apache.org/r/35384/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to