You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by mh...@apache.org on 2021/02/19 23:25:04 UTC

[geode] 01/03: trying to capture the time shift

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

mhanson pushed a commit to branch bugfix/GEODE-8958
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 44b18e2cbed9f3749eba2b215e1a77303d1ed1f2
Author: Mark Hanson <ha...@vmware.com>
AuthorDate: Thu Feb 11 16:18:48 2021 -0800

    trying to capture the time shift
---
 .../cache/versions/TombstoneDUnitTest.java         | 38 +++++++++++++++++++---
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
index dacd3ac..ba126db 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
@@ -133,6 +133,35 @@ public class TombstoneDUnitTest implements Serializable {
     });
   }
 
+
+  @Test
+  public void testGetOldestTombstoneTimeReplicateForTimestamp() {
+    VM server1 = VM.getVM(0);
+    VM server2 = VM.getVM(1);
+    final int count = 100000;
+    server1.invoke(() -> {
+      createCacheAndRegion(RegionShortcut.REPLICATE_PERSISTENT);
+      for (int i = 0; i < count; i++) {
+        region.put("K" + i, "V" + i);
+      }
+    });
+
+    server2.invoke(() -> createCacheAndRegion(RegionShortcut.REPLICATE));
+
+    server1.invoke(() -> {
+      TombstoneService.TombstoneSweeper tombstoneSweeper =
+          ((InternalCache) cache).getTombstoneService().getSweeper((LocalRegion) region);
+      // Send tombstone gc message to vm1.
+      for (int i = 0; i < count; i++) {
+        region.destroy("K" + i);
+        assertThat(tombstoneSweeper.getOldestTombstoneTime() + 30000 - System.currentTimeMillis()).isGreaterThan(0);
+        performGC(1);
+      }
+
+      assertThat(tombstoneSweeper.getOldestTombstoneTime()).isEqualTo(0);
+    });
+  }
+
   @Test
   public void testGetOldestTombstoneTimeNonReplicate() {
     VM client = VM.getVM(0);
@@ -169,8 +198,8 @@ public class TombstoneDUnitTest implements Serializable {
   }
 
   /**
-   * The purpose of this test is for a replicate region scenario to get the oldest tombstone
-   * and validate that it matches the tombstone of the entry we removed.
+   * The purpose of this test is for a replicate region scenario to get the oldest tombstone and
+   * validate that it matches the tombstone of the entry we removed.
    */
   @Test
   public void testGetOldestTombstoneReplicate() {
@@ -200,9 +229,8 @@ public class TombstoneDUnitTest implements Serializable {
 
 
   /**
-   * The purpose of this test is for a non-replicate region scenario to get the oldest tombstone
-   * and validate that it matches the tombstone of the entry we removed. This is done through a
-   * client
+   * The purpose of this test is for a non-replicate region scenario to get the oldest tombstone and
+   * validate that it matches the tombstone of the entry we removed. This is done through a client
    * as a client is required to have this non-replicate tombstone.
    */
   @Test