You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by on...@apache.org on 2020/08/18 00:45:20 UTC
[geode] branch develop updated: Revert "GEODE-8432: use regionPath directly instead of getRegion when put eve… (#5459)" (#5461)
This is an automated email from the ASF dual-hosted git repository.
onichols pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 75a7aa5 Revert "GEODE-8432: use regionPath directly instead of getRegion when put eve… (#5459)" (#5461)
75a7aa5 is described below
commit 75a7aa542e1896e40844de0267b6fbbc5be66702
Author: Xiaojian Zhou <ge...@users.noreply.github.com>
AuthorDate: Mon Aug 17 17:44:47 2020 -0700
Revert "GEODE-8432: use regionPath directly instead of getRegion when put eve… (#5459)" (#5461)
This reverts commit 8021084e4fdb4e03ef8495a190cc1618a6db67ba so it can be re-submitted with fixes to simplify back-porting.
---
.../wan/parallel/ParallelGatewaySenderQueue.java | 13 +++---
.../ParallelGatewaySenderQueueJUnitTest.java | 49 ----------------------
2 files changed, 7 insertions(+), 55 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 9625ef4..df531ce 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,14 +693,15 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
boolean isDREvent = isDREvent(sender.getCache(), value);
- String regionPath = value.getRegionPath();
- if (!isDREvent) {
- regionPath = ColocationHelper
- .getLeaderRegion((PartitionedRegion) sender.getCache().getRegion(regionPath))
- .getFullPath();
+ Region region = value.getRegion();
+ String regionPath = null;
+ if (isDREvent) {
+ regionPath = region.getFullPath();
+ } else {
+ regionPath = ColocationHelper.getLeaderRegion((PartitionedRegion) region).getFullPath();
}
if (isDebugEnabled) {
- logger.debug("Put is for the region {}", regionPath);
+ logger.debug("Put is for the region {}", region);
}
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 7f51b7b..b8acbcf 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,9 +17,7 @@ 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;
@@ -39,7 +37,6 @@ import org.mockito.stubbing.Answer;
import org.apache.geode.CancelCriterion;
import org.apache.geode.cache.DataPolicy;
-import org.apache.geode.cache.PartitionAttributes;
import org.apache.geode.cache.PartitionAttributesFactory;
import org.apache.geode.cache.Region;
import org.apache.geode.internal.cache.AbstractBucketRegionQueue;
@@ -79,52 +76,6 @@ public class ParallelGatewaySenderQueueJUnitTest {
}
@Test
- public void whenReplicatedDataRegionNotReadyShouldNotThrowException() throws Exception {
- GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class);
- when(event.makeHeapCopyIfOffHeap()).thenReturn(event);
- when(event.getRegion()).thenReturn(null);
- String regionPath = "/testRegion";
- when(event.getRegionPath()).thenReturn(regionPath);
- 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 whenPartitionedDataRegionNotReadyShouldNotThrowException() throws Exception {
- GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class);
- when(event.makeHeapCopyIfOffHeap()).thenReturn(event);
- when(event.getRegion()).thenReturn(null);
- String regionPath = "/testRegion";
- when(event.getRegionPath()).thenReturn(regionPath);
- PartitionedRegion region = mock(PartitionedRegion.class);
- when(region.getFullPath()).thenReturn(regionPath);
- when(cache.getRegion(regionPath)).thenReturn(region);
- PartitionAttributes pa = mock(PartitionAttributes.class);
- when(region.getPartitionAttributes()).thenReturn(pa);
- when(pa.getColocatedWith()).thenReturn(null);
-
- Mockito.doThrow(new IllegalStateException()).when(event).release();
- Queue backingList = new LinkedList();
- backingList.add(event);
-
- BucketRegionQueue bucketRegionQueue = mockBucketRegionQueue(backingList);
-
- TestableParallelGatewaySenderQueue queue = new TestableParallelGatewaySenderQueue(sender,
- Collections.emptySet(), 0, 1, metaRegionFactory);
- queue.setMockedAbstractBucketRegionQueue(bucketRegionQueue);
-
- queue = spy(queue);
- boolean putDone = queue.put(event);
- assertThat(putDone).isFalse();
- }
-
- @Test
public void whenEventReleaseFromOffHeapFailsExceptionShouldNotBeThrownToAckReaderThread()
throws Exception {
GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class);