You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dg...@apache.org on 2019/01/11 20:48:15 UTC

[ignite] branch master updated: IGNITE-10907 Fix IgniteUtilsSelfTest.testDoInParallelWithStealingJobRunTaskInExecutor flaky in PDS Basic 1

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

dgovorukhin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new e3dbc8f  IGNITE-10907 Fix IgniteUtilsSelfTest.testDoInParallelWithStealingJobRunTaskInExecutor flaky in PDS Basic 1
e3dbc8f is described below

commit e3dbc8f32a39fee5190ba59d43398cd0724b6a8f
Author: Dmitriy Govorukhin <dm...@gmail.com>
AuthorDate: Tue Dec 25 14:01:50 2018 +0300

    IGNITE-10907 Fix IgniteUtilsSelfTest.testDoInParallelWithStealingJobRunTaskInExecutor flaky in PDS Basic 1
---
 .../ignite/internal/util/IgniteUtilsSelfTest.java    | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
index 93b7586..757e40a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
@@ -62,6 +62,7 @@ import org.apache.ignite.compute.ComputeJob;
 import org.apache.ignite.compute.ComputeJobAdapter;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.processors.igfs.IgfsUtils;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.GridPeerDeployAware;
 import org.apache.ignite.internal.util.lang.IgniteThrowableConsumer;
 import org.apache.ignite.internal.util.typedef.F;
@@ -1095,14 +1096,31 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
 
         Collection<Integer> res;
 
+        // Future for avoiding fast execution in only executor threads.
+        // Here we try to pass a number of tasks more that executor size,
+        // but there is a case when all task will be completed after last submit return control and
+        // current thread can not steal task because all task will be already finished.
+        GridFutureAdapter fut = new GridFutureAdapter();
+
         try {
             res = U.doInParallel(10,
                 executorService,
                 data,
                 new IgniteThrowableConsumer<Integer, Integer>() {
                     @Override public Integer accept(Integer cnt) {
-                        if (Thread.currentThread().getId() == threadId)
+                        if (Thread.currentThread().getId() == threadId) {
+                            fut.onDone();
+
                             curThreadCnt.incrementAndGet();
+                        }
+                        else {
+                            try {
+                                fut.get();
+                            }
+                            catch (IgniteCheckedException e) {
+                                throw U.convertException(e);
+                            }
+                        }
 
                         return -cnt;
                     }