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 2018/10/19 21:29:36 UTC
[geode] branch feature/GEODE-5890 created (now 481b46f)
This is an automated email from the ASF dual-hosted git repository.
zhouxj pushed a change to branch feature/GEODE-5890
in repository https://gitbox.apache.org/repos/asf/geode.git.
at 481b46f GEODE-5890: a cleaner fix to skip calling GatewayConflictResolver if tag has the same distributed system id.
This branch includes the following new commits:
new 481b46f GEODE-5890: a cleaner fix to skip calling GatewayConflictResolver if tag has the same distributed system id.
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-5890: a cleaner fix to skip calling
GatewayConflictResolver if tag has the same distributed system id.
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-5890
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 481b46f671f98466b7b759a9440b95feb1c1c9c4
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Fri Oct 19 14:27:56 2018 -0700
GEODE-5890: a cleaner fix to skip calling GatewayConflictResolver if tag has
the same distributed system id.
---
.../apache/geode/internal/cache/entries/AbstractRegionEntry.java | 8 +++++++-
.../geode/internal/cache/entries/AbstractRegionEntryTest.java | 9 ++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/entries/AbstractRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/entries/AbstractRegionEntry.java
index fdadea0..1d728e3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/entries/AbstractRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/entries/AbstractRegionEntry.java
@@ -2073,8 +2073,14 @@ public abstract class AbstractRegionEntry implements HashRegionEntry<Object, Obj
if (tagTime == VersionTag.ILLEGAL_VERSION_TIMESTAMP) {
return true; // no timestamp received from other system - just apply it
}
+ // According to GatewayConflictResolver's java doc, it will only be used on tag with different
+ // distributed system id than stamp's
if ((tagDsid == stampDsid && tagTime > stampTime) || stampDsid == -1) {
- return true;
+ if (tagTime > stampTime) {
+ return true;
+ } else {
+ throw new ConcurrentCacheModificationException("conflicting WAN event detected");
+ }
}
GatewayConflictResolver resolver = event.getRegion().getCache().getGatewayConflictResolver();
if (resolver != null) {
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/entries/AbstractRegionEntryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/entries/AbstractRegionEntryTest.java
index 21ed680..04a98c2 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/entries/AbstractRegionEntryTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/entries/AbstractRegionEntryTest.java
@@ -29,7 +29,9 @@ import java.io.IOException;
import org.assertj.core.api.Assertions;
import org.junit.Assert;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.query.QueryException;
@@ -58,6 +60,9 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
public class AbstractRegionEntryTest {
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
@Test
public void whenMakeTombstoneHasSetValueThatThrowsExceptionDoesNotChangeValueToTombstone()
throws RegionClearedException {
@@ -118,7 +123,7 @@ public class AbstractRegionEntryTest {
}
}
- @Test(expected = ConcurrentCacheModificationException.class)
+ @Test
public void gatewayEventsFromSameDSShouldThrowCMEIfMisordered() {
// create 2 gateway events with the same dsid, but different timestamp
// apply them in misorder, it should throw CME
@@ -149,6 +154,8 @@ public class AbstractRegionEntryTest {
// apply tag1 with smaller timestamp should throw CME
entryEvent1.setVersionTag(tag1);
+ expectedException.expect(ConcurrentCacheModificationException.class);
+ expectedException.expectMessage("conflicting WAN event detected");
re.processVersionTag(entryEvent1);
}