Repository: ignite Updated Branches: refs/heads/master 98ef92593 -> 747e6c5f9
IGNITE-8204: SQL: fixed hangs when lazy flag is enabled. This closes #3785. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/747e6c5f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/747e6c5f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/747e6c5f Branch: refs/heads/master Commit: 747e6c5f9c635a5b9c6856efd2b94b05297b7f25 Parents: 98ef925 Author: Alexander Paschenko <alexander.a.pasche...@gmail.com> Authored: Wed Apr 11 16:20:16 2018 +0300 Committer: devozerov <voze...@gridgain.com> Committed: Wed Apr 11 16:20:16 2018 +0300 ---------------------------------------------------------------------- .../query/h2/twostep/GridMapQueryExecutor.java | 7 +++++++ .../query/h2/twostep/MapQueryLazyWorker.java | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/747e6c5f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java index 9b1e4fa..930ada2 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java @@ -234,6 +234,13 @@ public class GridMapQueryExecutor { } /** + * @return Busy lock for lazy workers to guard their operations with. + */ + GridSpinBusyLock busyLock() { + return busyLock; + } + + /** * @param node Node. * @param msg Message. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/747e6c5f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java index 59c050f..98f3df9 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java @@ -80,8 +80,17 @@ public class MapQueryLazyWorker extends GridWorker { while (!isCancelled()) { Runnable task = tasks.take(); - if (task != null) - task.run(); + if (task != null) { + if (!exec.busyLock().enterBusy()) + return; + + try { + task.run(); + } + finally { + exec.busyLock().leaveBusy(); + } + } } } finally {