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/08/14 00:29:49 UTC

[GitHub] [geode] mhansonp commented on a change in pull request #5457: GEODE-8430: add dunit test to verify tombstoneGC will not happen in u…

mhansonp commented on a change in pull request #5457:
URL: https://github.com/apache/geode/pull/5457#discussion_r470329301



##########
File path: geode-core/src/distributedTest/java/org/apache/geode/internal/cache/GIIDeltaDUnitTest.java
##########
@@ -1552,6 +1552,95 @@ public String description() {
     waitForToVerifyRVV(P, memberR, 6, null, 0); // P's rvv=r6, gc=0
   }
 
+  /**
+   * vm0 and vm1 are peers, each holds a DR. Let P and R have the same RVV and RVVGC: P7,R6, RVVGC
+   * is P0,R0. vm1 becomes offline then restarts. Use testHook to pause the GII, then do tombstone
+   * GC triggered by expireBatch (not by forceGC) at R only. The tombstone GC will be executed at P,
+   * but ignored at R, because P has not started providing GII and R is not initialized yet.
+   * The deltaGII should send nothing to R since the RVVs are the same. So after
+   * GII, P and R will have different tombstone number. But P's tombstones should be expired.
+   */
+  @Test
+  public void testExpiredTombstoneSkippedGCAtRequesterOnly() throws Throwable {
+    prepareForEachTest();
+    final DiskStoreID memberP = getMemberID(P);
+    final DiskStoreID memberR = getMemberID(R);
+
+    assertEquals(0, SLOW_DISTRIBUTION_MS);
+    prepareCommonTestData(6);
+
+    // let r4,r5,r6 to succeed
+    doOnePut(R, 4, "key4");
+    doOneDestroy(R, 5, "key5");
+    doOnePut(R, 6, "key1");
+
+    waitForToVerifyRVV(R, memberP, 6, null, 0); // P's rvv=p6, gc=0
+    waitForToVerifyRVV(R, memberR, 6, null, 0); // P's rvv=r6, gc=0
+    // now the rvv and rvvgc at P and R should be the same
+
+    // save R's rvv in byte array, check if it will be fullGII
+    byte[] R_rvv_bytes = getRVVByteArray(R, REGION_NAME);
+    // shutdown R and restart
+    closeCache(R);
+
+    // let p7 to succeed
+    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
+
+    // add test hook
+    P.invoke(new SerializableRunnable() {
+      @Override
+      public void run() {
+        Mycallback myDuringPackingImage =
+            new Mycallback(GIITestHookType.AfterReceivedRequestImage, REGION_NAME);
+        setGIITestHook(myDuringPackingImage);
+      }
+    });
+
+    checkIfFullGII(P, REGION_NAME, R_rvv_bytes, false);
+
+    // restart R and gii, it will be blocked at test hook
+    AsyncInvocation async3 = createDistributedRegionAsync(R);
+    // 8
+    waitForCallbackStarted(P, GIITestHookType.AfterReceivedRequestImage);
+    int count = getDeltaGIICount(P);
+    assertEquals(0, count);
+
+    // let tombstone expired at both P & R to trigger tombstoneGC.
+    // Wait for tombstone is GCed at P, but still exists in R
+    changeTombstoneTimout(R, MAX_WAIT);
+    changeTombstoneTimout(P, MAX_WAIT);
+    pause((int) MAX_WAIT);
+    forceGC(R, 3);
+    forceGC(P, 3);
+
+    // let GII continue
+    P.invoke(() -> resetGIITestHook(GIITestHookType.AfterReceivedRequestImage, true));
+    async3.join(MAX_WAIT * 2);

Review comment:
       .join() is deprecated, in the future you might just want to use await.




----------------------------------------------------------------
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