You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/10/01 22:40:10 UTC

[GitHub] [geode] DonalEvans commented on a change in pull request #5581: GEODE-8559: Compute interest routing info after transaction committed.

DonalEvans commented on a change in pull request #5581:
URL: https://github.com/apache/geode/pull/5581#discussion_r498515234



##########
File path: geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java
##########
@@ -1126,27 +1126,75 @@ public FilterRoutingInfo getFilterRoutingInfoPart1(CacheEvent event, Profile[] p
    */
   public FilterRoutingInfo getFilterRoutingInfoPart2(FilterRoutingInfo part1Info,
       CacheEvent event) {
+    return getFilterRoutingInfoPart2(part1Info, event, false);
+  }
+
+  public FilterRoutingInfo getFilterRoutingInfoPart2(FilterRoutingInfo part1Info,
+      CacheEvent event, boolean computeInterestRoutingInfo) {
     FilterRoutingInfo result = part1Info;
     if (localProfile.hasCacheServer) {
       // bug #45520 - CQ events arriving out of order causes result set
       // inconsistency, so don't compute routings for events in conflict
       boolean isInConflict =
           event.getOperation().isEntry() && ((EntryEventImpl) event).isConcurrencyConflict();
       CqService cqService = getCqService(event.getRegion());
-      if (!isInConflict && cqService.isRunning()
-          && this.region != null /*
-                                  * && !( this.region.isUsedForPartitionedRegionBucket() || //
-                                  * partitioned region CQ this.region instanceof PartitionedRegion)
-                                  */) { // processing is done in part 1
+      if (!isInConflict && cqService.isRunning() && region != null) {
         if (result == null) {
           result = new FilterRoutingInfo();
         }
         if (logger.isDebugEnabled()) {
           logger.debug("getting local cq matches for {}", event);
         }
-        fillInCQRoutingInfo(event, true, NO_PROFILES, result);
+        setLocalCQRoutingInfo(event, result);
       }
+      result = setLocalInterestRoutingInfo(event, result, computeInterestRoutingInfo);
+    }
+    return result;
+  }
+
+  void setLocalCQRoutingInfo(CacheEvent event, FilterRoutingInfo result) {
+    if (isCQRoutingNeeded(event)) {
+      fillInCQRoutingInfo(event, true, NO_PROFILES, result);
+    } else {
+      result.setLocalFilterInfo(getLocalFilterInfo(event));
+    }
+  }
+
+  boolean isCQRoutingNeeded(CacheEvent event) {
+    if (!isTransactionalEvent(event)) {
+      return true;
+    }
+    FilterInfo localFilterInfo = getLocalFilterInfo(event);
+    if (localFilterInfo != null) {
+      return false;
+    }
+    return true;

Review comment:
       This can be simplified to `return localFilterInfo == null;`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org