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/21 06:45:04 UTC
[geode] 01/01: GEODE-8444: When requester's RVV equals provider's
rvvGC, should do fullGII
This is an automated email from the ASF dual-hosted git repository.
zhouxj pushed a commit to branch feature/GEODE-8444
in repository https://gitbox.apache.org/repos/asf/geode.git
commit b5c69f60c1e4f68023c6dffde295be299f6e5914
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Thu Aug 20 23:43:46 2020 -0700
GEODE-8444: When requester's RVV equals provider's rvvGC, should do fullGII
---
.../geode/internal/cache/GIIDeltaDUnitTest.java | 85 ++++++++++++++++++++--
.../internal/cache/InitialImageOperation.java | 3 +-
.../cache/versions/RegionVersionVector.java | 6 +-
3 files changed, 86 insertions(+), 8 deletions(-)
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/GIIDeltaDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/GIIDeltaDUnitTest.java
index 1f3fcc1..4c59e5b 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/GIIDeltaDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/GIIDeltaDUnitTest.java
@@ -784,6 +784,8 @@ public class GIIDeltaDUnitTest extends JUnit4CacheTestCase {
doOnePut(P, 9, "key3");
waitForToVerifyRVV(P, memberP, 9, null, 0);
waitForToVerifyRVV(R, memberP, 9, exceptionlist2, 0);
+ verifyTombstoneExist(P, "key1", true, false);
+ waitToVerifyKey(R, "key1", generateValue(P));
byte[] R_rvv_bytes = getRVVByteArray(R, REGION_NAME);
closeCache(R);
@@ -794,6 +796,7 @@ public class GIIDeltaDUnitTest extends JUnit4CacheTestCase {
P.invoke(() -> GIIDeltaDUnitTest.resetSlowGII());
// restart and gii, R's rvv should be the same as P's
+ // should do full GII because P8 at P is GCed, but R still has key1
checkIfFullGII(P, REGION_NAME, R_rvv_bytes, true);
createDistributedRegion(R);
waitForToVerifyRVV(R, memberP, 9, null, 8); // R's rvv=p9, gc=8
@@ -805,6 +808,8 @@ public class GIIDeltaDUnitTest extends JUnit4CacheTestCase {
// In fullGII, the key size in gii chunk is 2. They are: key3, key5
verifyDeltaSizeFromStats(R, 2, 0);
+ waitToVerifyKey(P, "key1", null);
+ waitToVerifyKey(R, "key1", null);
}
/**
@@ -1695,8 +1700,9 @@ public class GIIDeltaDUnitTest extends JUnit4CacheTestCase {
/**
* P and R are peers, each holds a DR. Each does a few operations to make RVV=P7,R6, RVVGC=P0,R0
- * for both members. P8 is clear() operation. After that, R offline. Run P9 is a put. Restart R. R
- * will do deltaGII to get P9 as delta
+ * for both members. P8 is clear() operation. After that, run P9 R7 as put. R offline. Run P10 as
+ * another put.
+ * Restart R. R will do deltaGII to get P10 as delta
*/
@Test
public void testDeltaGIIAfterClear() throws Throwable {
@@ -1728,18 +1734,85 @@ public class GIIDeltaDUnitTest extends JUnit4CacheTestCase {
waitForToVerifyRVV(P, memberR, 6, null, 6); // P's rvv=r6, gc=6
waitForToVerifyRVV(R, memberP, 8, null, 8); // R's rvv=p8, gc=8
waitForToVerifyRVV(R, memberR, 6, null, 6); // R's rvv=r6, gc=6
+ doOnePut(R, 7, "key5");
+ doOnePut(P, 9, "key3");
// shutdown R
byte[] R_rvv_bytes = getRVVByteArray(R, REGION_NAME);
closeCache(R);
// do a put at P to get some delta
- doOnePut(P, 9, "key3");
+ doOnePut(P, 10, "key4");
+ waitForToVerifyRVV(P, memberP, 10, null, 8);
+ waitForToVerifyRVV(P, memberR, 7, null, 6);
+
+ // restart R to deltaGII
+ checkIfFullGII(P, REGION_NAME, R_rvv_bytes, false);
+
+ // shutdown P and restart
+ closeCache(P);
+ createDistributedRegion(P);
+ waitForToVerifyRVV(P, memberP, 10, null, 8);
+ waitForToVerifyRVV(P, memberR, 7, null, 6);
+
+ createDistributedRegion(R);
+ waitForToVerifyRVV(R, memberP, 10, null, 8);
+ waitForToVerifyRVV(R, memberR, 7, null, 6);
+
+ RegionVersionVector p_rvv = getRVV(P);
+ RegionVersionVector r_rvv = getRVV(R);
+ assertSameRVV(p_rvv, r_rvv); // after gii, rvv should be the same
+
+ verifyDeltaSizeFromStats(R, 1, 1);
+ }
+
+ /**
+ * P and R are peers, each holds a DR. Each does a few operations to make RVV=P7,R6, RVVGC=P0,R0
+ * for both members. P8 is clear() operation. After that, R offline. Run P9 as another put.
+ * Restart R. R will do FullGII to get P9 because R's rvv==P's rvvGC on R
+ */
+ @Test
+ public void GIIAfterClearWillBeFullGII() throws Throwable {
+ prepareForEachTest();
+ final DiskStoreID memberP = getMemberID(P);
+ final DiskStoreID memberR = getMemberID(R);
+ final long[] exceptionlist = {4, 5};
+
+ assertEquals(0, DistributedCacheOperation.SLOW_DISTRIBUTION_MS);
+ prepareCommonTestData(6);
+ // let r4,r5,r6 to succeed
+ doOnePut(R, 4, "key4");
+ doOneDestroy(R, 5, "key5");
+ doOnePut(R, 6, "key1");
+
+ doOnePut(P, 7, "key1");
+
+ waitForToVerifyRVV(P, memberP, 7, null, 0); // P's rvv=p7, gc=0
+ waitForToVerifyRVV(P, memberR, 6, null, 0); // P's rvv=r6, gc=0
+ waitForToVerifyRVV(R, memberP, 7, null, 0); // R's rvv=P7, gc=0
+ waitForToVerifyRVV(R, memberR, 6, null, 0); // R's rvv=r6, gc=0
+
+ // Note: since R is still online, clear will do flush message which will be blocked by the
+ // test CDL (to create unfinished operation). So in this test, no exception
+ doOneClear(P, 8);
+ // clear() increased P's version with 1 to P8
+ // after clear, P and R's RVVGC == RVV
+ waitForToVerifyRVV(P, memberP, 8, null, 8); // P's rvv=p8, gc=8
+ waitForToVerifyRVV(P, memberR, 6, null, 6); // P's rvv=r6, gc=6
+ waitForToVerifyRVV(R, memberP, 8, null, 8); // R's rvv=p8, gc=8
+ waitForToVerifyRVV(R, memberR, 6, null, 6); // R's rvv=r6, gc=6
+
+ // shutdown R
+ byte[] R_rvv_bytes = getRVVByteArray(R, REGION_NAME);
+ closeCache(R);
+
+ // do a put at P to get some delta
+ doOnePut(P, 9, "key4");
waitForToVerifyRVV(P, memberP, 9, null, 8);
waitForToVerifyRVV(P, memberR, 6, null, 6);
// restart R to deltaGII
- checkIfFullGII(P, REGION_NAME, R_rvv_bytes, false);
+ checkIfFullGII(P, REGION_NAME, R_rvv_bytes, true);
// shutdown P and restart
closeCache(P);
@@ -1755,7 +1828,7 @@ public class GIIDeltaDUnitTest extends JUnit4CacheTestCase {
RegionVersionVector r_rvv = getRVV(R);
assertSameRVV(p_rvv, r_rvv); // after gii, rvv should be the same
- verifyDeltaSizeFromStats(R, 1, 1);
+ verifyDeltaSizeFromStats(R, 1, 0);
}
/**
@@ -1828,7 +1901,7 @@ public class GIIDeltaDUnitTest extends JUnit4CacheTestCase {
waitForToVerifyRVV(R, memberR, 6, null, 6); // R's rvv=r6, gc=6
waitToVerifyKey(P, "key1", null);
waitToVerifyKey(R, "key1", null);
- verifyDeltaSizeFromStats(R, 0, 1);
+ verifyDeltaSizeFromStats(R, 0, 0);
}
/**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
index 3698dbb..6d3ba1e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
@@ -1670,7 +1670,8 @@ public class InitialImageOperation {
// [bruce] I suppose it's possible to have this check return a list of
// specific versions that the sender is missing. The current check
// just stops when it finds the first inconsistency
- if (!rgn.getVersionVector().isNewerThanOrCanFillExceptionsFor(this.versionVector)) {
+ if (!rgn.getVersionVector().isNewerThanOrCanFillExceptionsFor(this.versionVector)
+ && rgn.getVersionVector().isRVVGCDominatedBy(this.versionVector)) {
// Delta GII might have unfinished operations to send. Otherwise,
// no need to send any data. This is a synchronization request and this region's
// vector doesn't have anything that the other region needs
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/versions/RegionVersionVector.java b/geode-core/src/main/java/org/apache/geode/internal/cache/versions/RegionVersionVector.java
index 13a0da7..a80943c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/versions/RegionVersionVector.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/versions/RegionVersionVector.java
@@ -1000,7 +1000,11 @@ public abstract class RegionVersionVector<T extends VersionSource<?>>
return true;
} else {
RegionVersionHolder<T> holder = new RegionVersionHolder<T>(gcVersion.longValue());
- return !holder.isNewerThanOrCanFillExceptionsFor(otherHolder);
+ if (otherHolder == null) {
+ return false;
+ } else {
+ return otherHolder.dominates(holder) && otherHolder.getVersion() > gcVersion;
+ }
}
}