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

ASF GitHub Bot commented on GEODE-2745:
---------------------------------------

Github user jhuynh1 commented on a diff in the pull request:

    https://github.com/apache/geode/pull/448#discussion_r111011735
  
    --- Diff: 
geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java 
---
    @@ -464,16 +464,21 @@ private void setLatestAcknowledgedKey(Long key) {
         this.latestAcknowledgedKey.set(key);
       }
     
    -  public boolean waitUntilFlushed(long timeout, TimeUnit unit) throws 
InterruptedException {
    +  public long getLatestQueuedKey() {
    +    return this.latestQueuedKey.get();
    +  }
    +
    +  public boolean waitUntilFlushed(long latestQueuedKey, long timeout, 
TimeUnit unit)
    +      throws InterruptedException {
         long then = System.currentTimeMillis();
         if (logger.isDebugEnabled()) {
    -      logger.debug("BucketRegionQueue: waitUntilFlushed bucket=" + getId() 
+ "; timeout=" + timeout
    -          + "; unit=" + unit);
    +      logger.debug("BucketRegionQueue: waitUntilFlushed bucket=" + getId() 
+ "; latestQueuedKey="
    +          + latestQueuedKey + "; timeout=" + timeout + "; unit=" + unit);
         }
         boolean result = false;
         // Wait until latestAcknowledgedKey > latestQueuedKey or the queue is 
empty
         if (this.initialized) {
    -      long latestQueuedKeyToCheck = this.latestQueuedKey.get();
    +      long latestQueuedKeyToCheck = latestQueuedKey;
    --- End diff --
    
    Not an actual problem, but we probably could just replace this variable 
altogether and only use latestQueueKey instead.  


> The AsyncEventQueueImpl waitUntilFlushed method waits longer than it should 
> for events to be flushed
> ----------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-2745
>                 URL: https://issues.apache.org/jira/browse/GEODE-2745
>             Project: Geode
>          Issue Type: Bug
>          Components: wan
>            Reporter: Barry Oglesby
>
> With the changes to waitUntilFlushed to process 10 buckets at a time, if 
> events are happening while waitUntilFlushed is in progress, then all the 
> buckets after the first 10 will have processed more than it should before 
> returning.
> If the update rate is causing the queue to always contain 113000 events, and 
> the events are spread evenly across the buckets, each bucket will have 1000 
> events to wait for. The first 10 buckets will wait for their 1000 events. 
> When those have been processed, the next 10 buckets will wait for their 1000 
> events starting from that point, but they've already processed 1000 events. 
> So, these buckets will actually wait for 2000 events to be processed before 
> returning. This pattern continues until all the buckets are done.
> The WaitUntilBucketRegionQueueFlushedCallable needs to track not only the 
> BucketRegionQueue but also the latestQueuedKey.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to