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 2021/06/11 22:40:28 UTC

[geode] branch feature/GEODE-9373 created (now 6ccd9bc)

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

zhouxj pushed a change to branch feature/GEODE-9373
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at 6ccd9bc  GEODE-9373: add testEventIdOutOfOrderInPartitionRegionSingleHopFromClientRegisteredInterest

This branch includes the following new commits:

     new 6ccd9bc  GEODE-9373: add testEventIdOutOfOrderInPartitionRegionSingleHopFromClientRegisteredInterest

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-9373: add testEventIdOutOfOrderInPartitionRegionSingleHopFromClientRegisteredInterest

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-9373
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 6ccd9bccd70c572e42b1904a19f4dcf733c6daea
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Fri Jun 11 15:38:43 2021 -0700

    GEODE-9373: add testEventIdOutOfOrderInPartitionRegionSingleHopFromClientRegisteredInterest
---
 .../cache/PutAllClientServerDistributedTest.java   | 103 +++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/PutAllClientServerDistributedTest.java b/geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/PutAllClientServerDistributedTest.java
index 67423c8..a5c20c4 100755
--- a/geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/PutAllClientServerDistributedTest.java
+++ b/geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/PutAllClientServerDistributedTest.java
@@ -2486,6 +2486,109 @@ public class PutAllClientServerDistributedTest implements Serializable {
   }
 
   /**
+   * The purpose of this test is to validate that when two servers of three in a cluster configured
+   * with a client doing singlehop, that the client which registered interest gets afterCreate
+   * messages for each
+   * entry in the putall.
+   * Further, we also check that the region size is correct on the remaining server.
+   *
+   */
+  @Test
+  public void testEventIdOutOfOrderInPartitionRegionSingleHopFromClientRegisteredInterest() {
+    VM server3 = client2;
+
+    int serverPort1 = server1.invoke(() -> new ServerBuilder()
+        .regionShortcut(PARTITION)
+        .create());
+
+    int serverPort2 = server2.invoke(() -> new ServerBuilder()
+        .regionShortcut(PARTITION)
+        .create());
+
+    int serverPort3 = server3.invoke(() -> new ServerBuilder()
+        .regionShortcut(PARTITION)
+        .create());
+
+    client1.invoke(() -> new ClientBuilder()
+        .prSingleHopEnabled(true)
+        .serverPorts(serverPort1, serverPort2, serverPort3)
+        .subscriptionAckInterval()
+        .subscriptionEnabled(true)
+        .subscriptionRedundancy()
+        .create());
+
+    new ClientBuilder()
+        .prSingleHopEnabled(true)
+        .serverPorts(serverPort1, serverPort2, serverPort3)
+        .subscriptionAckInterval()
+        .subscriptionEnabled(true)
+        .subscriptionRedundancy()
+        .create();
+
+    Region<String, TickerData> myRegion = getClientCache().getRegion(regionName);
+    myRegion.registerInterest("ALL_KEYS");
+
+    // do some putAll to get ClientMetaData for future putAll
+    client1.invoke(() -> doPutAll(getClientCache().getRegion(regionName), "key-", ONE_HUNDRED));
+
+    // register interest and add listener
+    Counter clientCounter = new Counter("client");
+    myRegion.getAttributesMutator().addCacheListener(new CountingCacheListener<>(clientCounter));
+
+    // server1 and server2 will closeCache after created 10 keys
+    // server1 add slow listener
+    server1.invoke(() -> {
+      Region<String, TickerData> region = getCache().getRegion(regionName);
+      region.getAttributesMutator()
+          .addCacheListener(new SlowCountingCacheListener<>(new Action<>(Operation.CREATE,
+              creates -> closeCacheConditionally(creates, 10))));
+    });
+
+    // server2 add slow listener
+    server2.invoke(() -> {
+      Region<String, TickerData> region = getCache().getRegion(regionName);
+      region.getAttributesMutator()
+          .addCacheListener(new SlowCountingCacheListener<>(new Action<>(Operation.CREATE,
+              creates -> closeCacheConditionally(creates, 20))));
+    });
+
+    // server3 add slow listener
+    server3.invoke(() -> {
+      COUNTER.set(new Counter("server3"));
+      Region<String, TickerData> region = getCache().getRegion(regionName);
+      region.getAttributesMutator()
+          .addCacheListener(new SlowCountingCacheListener<>(COUNTER.get()));
+    });
+
+    // client1 add listener and putAll
+    client1.invoke(() -> {
+      Region<String, TickerData> region = getClientCache().getRegion(regionName);
+      doPutAll(region, keyPrefix, ONE_HUNDRED); // fails in GEODE-7812
+    });
+
+    client1.invoke(() -> await()
+        .untilAsserted(() -> assertThat(clientCounter.getCreates()).isEqualTo(ONE_HUNDRED)));
+
+    await().untilAsserted(() -> assertThat(clientCounter.getCreates()).isEqualTo(ONE_HUNDRED));
+
+    assertThat(clientCounter.getUpdates()).isZero();
+
+    // server1 and server2 will closeCache after created 10 keys
+    // server3 print counter
+    server3.invoke(() -> {
+      Region<String, TickerData> region = getCache().getRegion(regionName);
+
+      assertThat(region.size())
+          .describedAs("Should have 100 entries plus 3 to 4 buckets worth of entries")
+          .isIn(ONE_HUNDRED + 3 * (ONE_HUNDRED) / 10, ONE_HUNDRED + 4 * (ONE_HUNDRED) / 10);
+      assertThat(COUNTER.get().getUpdates()).isZero();
+      verifyPutAll(region, keyPrefix);
+
+    });
+
+  }
+
+  /**
    * Tests while putAll to 2 distributed servers, one server failed over Add a listener to slow down
    * the processing of putAll
    */