You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by la...@apache.org on 2018/06/22 20:17:38 UTC

[geode] branch feature/GEODE-5344 created (now 5a95645)

This is an automated email from the ASF dual-hosted git repository.

ladyvader pushed a change to branch feature/GEODE-5344
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at 5a95645  GEODE-5344: Message Dispatcher needs to skip messages removed from HAContainer by QueueRemovalThread

This branch includes the following new commits:

     new 5a95645  GEODE-5344: Message Dispatcher needs to skip messages removed from HAContainer by QueueRemovalThread

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[geode] 01/01: GEODE-5344: Message Dispatcher needs to skip messages removed from HAContainer by QueueRemovalThread

Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ladyvader pushed a commit to branch feature/GEODE-5344
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 5a95645f759dc462f98e86d85d7a627d5a57e5d9
Author: Lynn Hughes-Godfrey <lh...@pivotal.io>
AuthorDate: Fri Jun 22 13:14:35 2018 -0700

    GEODE-5344: Message Dispatcher needs to skip messages removed from HAContainer by QueueRemovalThread
    
    - Message Dispatcher peek() needs to handle events which are no longer in the HAContainer; otherwise
      it gets stuck on that event and stops delivering events on that HARegionQueue.
---
 .../geode/internal/cache/ha/HARegionQueue.java     | 29 +++++++++++++---------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
index 6928b8d..a5c9dda 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
@@ -1374,22 +1374,27 @@ public class HARegionQueue implements RegionQueue {
       }
       object = (Conflatable) this.region.get(next);
       if (object != null) {
-        // peeked a object, so add the correponding counter to thread-context
+        // peeked a object, so add the corresponding counter to thread-context
         object = (object instanceof HAEventWrapper) ? (Conflatable) this.haContainer.get(object)
             : object;
 
-        if (object != null) { // Is it possible for object to be null...when?
-          List peekedEvents;
-          if ((peekedEvents = (List) HARegionQueue.peekedEventsContext.get()) != null) {
-            peekedEvents.add(next);
-          } else {
-            peekedEvents = new LinkedList();
-            peekedEvents.add(next);
-            HARegionQueue.peekedEventsContext.set(peekedEvents);
-          }
-          this.storePeekedID(next);
-          break;
+        // Fix for GEODE-5344 - Removing if (object != null) check here.
+        // It is possible that the object is null at this point as it is no longer in the
+        // HAContainer. This can occur when the QRM thread is already processing a list
+        // of events seen by the client and removes that event from the HAContainer as
+        // part of that processing at the same time this server becomes primary for that
+        // queue and then attempts to dispatch it. We must now skip this event to allow the
+        // dispatcher to process any subsequent events to the client.
+        List peekedEvents;
+        if ((peekedEvents = (List) HARegionQueue.peekedEventsContext.get()) != null) {
+          peekedEvents.add(next);
+        } else {
+          peekedEvents = new LinkedList();
+          peekedEvents.add(next);
+          HARegionQueue.peekedEventsContext.set(peekedEvents);
         }
+        this.storePeekedID(next);
+        break;
       }
     }
     // since size is zero, return null