You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2020/08/14 20:58:59 UTC

[geode] branch feature/GEODE-8432 created (now 89779e6)

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

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


      at 89779e6  GEODE-8432: use regionPath directly instead of getRegion when put event into parallelGatewaySenderQueue

This branch includes the following new commits:

     new 89779e6  GEODE-8432: use regionPath directly instead of getRegion when put event into parallelGatewaySenderQueue

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-8432: use regionPath directly instead of getRegion when put event into parallelGatewaySenderQueue

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

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

commit 89779e644f216b7fc70973660c7e26ee27bb99b9
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Fri Aug 14 13:56:51 2020 -0700

    GEODE-8432: use regionPath directly instead of getRegion when put event into parallelGatewaySenderQueue
---
 .../cache/wan/parallel/ParallelGatewaySenderQueue.java | 12 +++++-------
 .../parallel/ParallelGatewaySenderQueueJUnitTest.java  | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index df531ce..3c01647 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -693,15 +693,13 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
 
     boolean isDREvent = isDREvent(sender.getCache(), value);
 
-    Region region = value.getRegion();
-    String regionPath = null;
-    if (isDREvent) {
-      regionPath = region.getFullPath();
-    } else {
-      regionPath = ColocationHelper.getLeaderRegion((PartitionedRegion) region).getFullPath();
+    String regionPath = value.getRegionPath();
+    if (!isDREvent) {
+      regionPath =
+          ColocationHelper.getLeaderRegion((PartitionedRegion) value.getRegion()).getFullPath();
     }
     if (isDebugEnabled) {
-      logger.debug("Put is for the region {}", region);
+      logger.debug("Put is for the region {}", regionPath);
     }
     if (!this.userRegionNameToShadowPRMap.containsKey(regionPath)) {
       if (isDebugEnabled) {
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueueJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueueJUnitTest.java
index b8acbcf..200e75f 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueueJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueueJUnitTest.java
@@ -17,7 +17,9 @@ package org.apache.geode.internal.cache.wan.parallel;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -76,6 +78,22 @@ public class ParallelGatewaySenderQueueJUnitTest {
   }
 
   @Test
+  public void whenDataRegionNotReadyShouldNotThrowException() throws Exception {
+    GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class);
+    when(event.makeHeapCopyIfOffHeap()).thenReturn(event);
+    when(event.getRegion()).thenReturn(null);
+    when(event.getRegionPath()).thenReturn("/testRegion");
+    Mockito.doThrow(new IllegalStateException()).when(event).release();
+    Queue backingList = new LinkedList();
+    backingList.add(event);
+
+    queue = spy(queue);
+    doReturn(true).when(queue).isDREvent(any(), any());
+    boolean putDone = queue.put(event);
+    assertThat(putDone).isFalse();
+  }
+
+  @Test
   public void whenEventReleaseFromOffHeapFailsExceptionShouldNotBeThrownToAckReaderThread()
       throws Exception {
     GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class);