IGNITE-10437 Fixed flaky 
GridCacheWriteBehindStoreMultithreadedSelfTest.testFlushFromTheSameThreadWithCoalescing
 - Fixes #5522.

Signed-off-by: Alexey Goncharuk <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5990bcdc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5990bcdc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5990bcdc

Branch: refs/heads/ignite-10044
Commit: 5990bcdc53e9d4d59f724ff6dd6d54e9158339ee
Parents: 5fa79c6
Author: Dmitrii Ryabov <[email protected]>
Authored: Wed Dec 5 19:42:58 2018 +0300
Committer: Alexey Goncharuk <[email protected]>
Committed: Wed Dec 5 19:42:58 2018 +0300

----------------------------------------------------------------------
 ...heWriteBehindStoreMultithreadedSelfTest.java | 35 ++++++++++++--------
 1 file changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5990bcdc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
index 4fce452..a9558aa 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
@@ -187,33 +187,42 @@ public class 
GridCacheWriteBehindStoreMultithreadedSelfTest extends GridCacheWri
         // 50 milliseconds should be enough.
         delegate.setOperationDelay(50);
 
-        initStore(2, writeCoalescing);
+        Set<Integer> exp = null;
 
-        Set<Integer> exp;
+        int start = 0;
+        int end = 0;
 
-        int start = store.getWriteBehindTotalCriticalOverflowCount();
+        long startTime = System.currentTimeMillis();
 
-        try {
-            //We will have in total 5 * CACHE_SIZE keys that should be enough 
to grow map size to critical value.
-            exp = runPutGetRemoveMultithreaded(5, CACHE_SIZE);
-        }
-        finally {
-            log.info(">>> Done inserting, shutting down the store");
+        while (end - start == 0 && System.currentTimeMillis() - startTime < 
getTestTimeout()) {
+            initStore(2, writeCoalescing);
 
-            shutdownStore();
+            start = store.getWriteBehindTotalCriticalOverflowCount();
+
+            try {
+                //We will have in total 5 * CACHE_SIZE keys that should be 
enough to grow map size to critical value.
+                exp = runPutGetRemoveMultithreaded(5, CACHE_SIZE);
+            }
+            finally {
+                log.info(">>> Done inserting, shutting down the store");
+
+                shutdownStore();
+            }
+
+            end = store.getWriteBehindTotalCriticalOverflowCount();
         }
 
         // Restore delay.
         delegate.setOperationDelay(0);
 
-        Map<Integer, String> map = delegate.getMap();
-
-        int end = store.getWriteBehindTotalCriticalOverflowCount();
+        assertNotNull(exp);
 
         log.info(">>> There are " + exp.size() + " keys in store, " + (end - 
start) + " overflows detected");
 
         assertTrue("No cache overflows detected (a bug or too few keys or too 
few delay?)", end > start);
 
+        Map<Integer, String> map = delegate.getMap();
+
         Collection<Integer> extra = new HashSet<>(map.keySet());
 
         extra.removeAll(exp);

Reply via email to