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/04/18 21:57:43 UTC

[geode] 01/01: GEODE-5106: when primary queue is drained, the PQRM maybe still on the way.

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

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

commit 540473958388f8000b45faf6bf771d54df8a2dc5
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Wed Apr 18 14:56:18 2018 -0700

    GEODE-5106: when primary queue is drained, the PQRM maybe still on the way.
---
 .../wan/parallel/ParallelWANConflationDUnitTest.java  | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
index 9a85871..41cd89a 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
@@ -20,7 +20,9 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Random;
+import java.util.concurrent.TimeUnit;
 
+import org.awaitility.Awaitility;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -135,11 +137,23 @@ public class ParallelWANConflationDUnitTest extends WANTestBase {
 
     assertTrue("No events conflated in batch",
         (v4List.get(8) + v5List.get(8) + v6List.get(8) + v7List.get(8)) > 0);
-    assertEquals("Event in secondary queue should be 0 after dispatched", 0,
-        (v4List.get(10) + v5List.get(10) + v6List.get(10) + v7List.get(10)));
 
+    verifyEventSecondaryQueuesDrained("ln");
     vm2.invoke(() -> validateRegionSize(getTestMethodName(), 10));
+  }
 
+  private void verifyEventSecondaryQueuesDrained(final String senderId) {
+    Awaitility.await().atMost(120, TimeUnit.SECONDS).until(() -> {
+      int vm4SecondarySize = vm4.invoke(() -> getSecondaryQueueSizeInStats("ln"));
+      int vm5SecondarySize = vm5.invoke(() -> getSecondaryQueueSizeInStats("ln"));
+      int vm6SecondarySize = vm6.invoke(() -> getSecondaryQueueSizeInStats("ln"));
+      int vm7SecondarySize = vm7.invoke(() -> getSecondaryQueueSizeInStats("ln"));
+
+      assertEquals(
+          "Event in secondary queue should be 0 after dispatched, but actual is " + vm4SecondarySize
+              + ":" + vm5SecondarySize + ":" + vm6SecondarySize + ":" + vm7SecondarySize,
+          0, vm4SecondarySize + vm5SecondarySize + vm6SecondarySize + vm7SecondarySize);
+    });
   }
 
   @Test
@@ -189,6 +203,7 @@ public class ParallelWANConflationDUnitTest extends WANTestBase {
 
     // after dispatch, both primary and secondary queues are empty
     vm4.invoke(() -> checkQueueSize("ln", 0));
+    verifyEventSecondaryQueuesDrained("ln");
     validateEventSecondaryQueueSize(0, redundancy);
   }
 

-- 
To stop receiving notification emails like this one, please contact
zhouxj@apache.org.