IGNITE-8892 Fixed CacheQueryFuture usage in DataStructures processor - Fixes #4415.
Signed-off-by: Alexey Goncharuk <alexey.goncha...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/281a4006 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/281a4006 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/281a4006 Branch: refs/heads/ignite-8446 Commit: 281a40064bf5fd3ebb24e313b08f848a51a64b93 Parents: 2e1b4b9 Author: Andrey V. Mashenkov <andrey.mashen...@gmail.com> Authored: Tue Jul 24 17:38:34 2018 +0300 Committer: Alexey Goncharuk <alexey.goncha...@gmail.com> Committed: Tue Jul 24 17:38:34 2018 +0300 ---------------------------------------------------------------------- .../processors/datastructures/GridCacheSetImpl.java | 6 ++++-- .../GridCacheFullTextQueryMultithreadedSelfTest.java | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/281a4006/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java index c27770f..0e3e102 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java @@ -168,11 +168,13 @@ public class GridCacheSetImpl<T> extends AbstractCollection<T> implements Ignite qry.projection(ctx.grid().cluster().forNodes(nodes)); - Iterable<Integer> col = (Iterable<Integer>)qry.execute(new SumReducer()).get(); + CacheQueryFuture<Integer> qryFut = qry.execute(new SumReducer()); int sum = 0; - for (Integer val : col) + Integer val; + + while((val = qryFut.next()) != null) sum += val; return sum; http://git-wip-us.apache.org/repos/asf/ignite/blob/281a4006/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java index e12e246..acb3d73 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache; -import java.util.Collection; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicBoolean; @@ -26,6 +25,7 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.processors.cache.query.CacheQuery; +import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.S; @@ -105,12 +105,17 @@ public class GridCacheFullTextQueryMultithreadedSelfTest extends GridCacheAbstra int cnt = 0; while (!stop.get()) { - Collection<Map.Entry<Integer, H2TextValue>> res = qry.execute().get(); + CacheQueryFuture<Map.Entry<Integer, H2TextValue>> qryFut = qry.execute(); + + int size = 0; + + while(qryFut.next() != null) + size++; cnt++; if (cnt % logFreq == 0) { - X.println("Result set: " + res.size()); + X.println("Result set: " + size); X.println("Executed queries: " + cnt); } }