You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2019/02/04 08:16:51 UTC

[ignite] branch col_model created (now 9dfda73)

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

vozerov pushed a change to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git.


      at 9dfda73  WIP.

This branch includes the following new commits:

     new 160e04c  Converted multiplier to enum.
     new 9039d6a  Minors.
     new 3b21ea7  Moved.
     new 896bc23  Merge branch 'master' into col_model
     new 353fe53  Merge branch 'master' into col_model
     new 3c5c42b  Merge with master.
     new 37ba8a6  Minors.
     new 9dfda73  WIP.

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[ignite] 03/08: Moved.

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3b21ea72cbfc56645d3b1f23bd06ddf71bd360d8
Author: devozerov <vo...@gridgain.com>
AuthorDate: Fri Feb 1 18:17:35 2019 +0300

    Moved.
---
 .../query/h2/opt/join/CollocationModel.java        | 151 +++++++--------------
 .../h2/opt/join/CollocationModelAffinity.java      |  32 +++++
 .../query/h2/opt/join/CollocationModelType.java    |  83 +++++++++++
 3 files changed, 162 insertions(+), 104 deletions(-)

diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index 6b4dcb7..c3c2412 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@ -46,6 +46,9 @@ import org.h2.table.TableView;
  * Collocation model for a query.
  */
 public final class CollocationModel {
+    /** Empty filter array. */
+    private static final TableFilter[] EMPTY_FILTERS = new TableFilter[0];
+
     /** */
     private final CollocationModel upper;
 
@@ -59,7 +62,7 @@ public final class CollocationModel {
     private CollocationModelMultiplier multiplier;
 
     /** */
-    private Type type;
+    private CollocationModelType type;
 
     /** */
     private CollocationModel[] children;
@@ -245,7 +248,7 @@ public final class CollocationModel {
             for (int i = 0; i < childFilters.length; i++) {
                 CollocationModel child = child(i, true);
 
-                Type t = child.type(true);
+                CollocationModelType t = child.type(true);
 
                 if (child.multiplier == CollocationModelMultiplier.REPLICATED_NOT_LAST)
                     maxMultiplier = child.multiplier;
@@ -268,7 +271,7 @@ public final class CollocationModel {
                 }
             }
 
-            type = Type.of(partitioned, collocated);
+            type = CollocationModelType.of(partitioned, collocated);
             multiplier = maxMultiplier;
         }
         else {
@@ -280,7 +283,7 @@ public final class CollocationModel {
 
             // Only partitioned tables will do distributed joins.
             if (!(tbl instanceof GridH2Table) || !((GridH2Table)tbl).isPartitioned()) {
-                type = Type.REPLICATED;
+                type = CollocationModelType.REPLICATED;
                 multiplier = CollocationModelMultiplier.COLLOCATED;
 
                 return;
@@ -289,8 +292,8 @@ public final class CollocationModel {
             // If we are the first partitioned table in a join, then we are "base" for all the rest partitioned tables
             // which will need to get remote result (if there is no affinity condition). Since this query is broadcasted
             // to all the affinity nodes the "base" does not need to get remote results.
-            if (!upper.findPartitionedTableBefore(filter)) {
-                type = Type.PARTITIONED_COLLOCATED;
+            if (!upper.isPartitionedTableBeforeExists(filter)) {
+                type = CollocationModelType.PARTITIONED_COLLOCATED;
                 multiplier = CollocationModelMultiplier.COLLOCATED;
             }
             else {
@@ -298,19 +301,19 @@ public final class CollocationModel {
                 // collocated. If we at least have affinity key condition, then we do unicast which is cheaper.
                 switch (upper.joinedWithCollocated(filter)) {
                     case COLLOCATED_JOIN:
-                        type = Type.PARTITIONED_COLLOCATED;
+                        type = CollocationModelType.PARTITIONED_COLLOCATED;
                         multiplier = CollocationModelMultiplier.COLLOCATED;
 
                         break;
 
                     case HAS_AFFINITY_CONDITION:
-                        type = Type.PARTITIONED_NOT_COLLOCATED;
+                        type = CollocationModelType.PARTITIONED_NOT_COLLOCATED;
                         multiplier = CollocationModelMultiplier.UNICAST;
 
                         break;
 
                     case NONE:
-                        type = Type.PARTITIONED_NOT_COLLOCATED;
+                        type = CollocationModelType.PARTITIONED_NOT_COLLOCATED;
                         multiplier = CollocationModelMultiplier.BROADCAST;
 
                         break;
@@ -320,18 +323,20 @@ public final class CollocationModel {
                 }
             }
 
-            if (upper.previousReplicated(filter))
+            if (upper.isPreviousTableReplicated(filter))
                 multiplier = CollocationModelMultiplier.REPLICATED_NOT_LAST;
         }
     }
 
     /**
-     * @param f Current filter.
-     * @return {@code true} If partitioned table was found.
+     * Check whether at least one PARTITIONED table is located before current table.
+     *
+     * @param filterIdx Current filter index.
+     * @return {@code true} If PARTITIONED table exists.
      */
-    private boolean findPartitionedTableBefore(int f) {
-        for (int i = 0; i < f; i++) {
-            CollocationModel child = child(i, true);
+    private boolean isPartitionedTableBeforeExists(int filterIdx) {
+        for (int idx = 0; idx < filterIdx; idx++) {
+            CollocationModel child = child(idx, true);
 
             // The c can be null if it is not a GridH2Table and not a sub-query,
             // it is a some kind of function table or anything else that considered replicated.
@@ -340,19 +345,26 @@ public final class CollocationModel {
         }
 
         // We have to search globally in upper queries as well.
-        return upper != null && upper.findPartitionedTableBefore(filter);
+        return upper != null && upper.isPartitionedTableBeforeExists(filter);
     }
 
     /**
-     * @param f Current filter.
+     * Check if previous table in the sequence is REPLICATED.
+     *
+     * @param filterIdx Current filter index.
      * @return {@code true} If previous table is REPLICATED.
      */
-    @SuppressWarnings("SimplifiableIfStatement")
-    private boolean previousReplicated(int f) {
-        if (f > 0 && child(f - 1, true).type(true) == Type.REPLICATED)
+    private boolean isPreviousTableReplicated(int filterIdx) {
+        // We are at the first table, nothing exists before it
+        if (filterIdx == 0)
+            return false;
+
+        CollocationModel child = child(filterIdx - 1, true);
+
+        if (child != null && child.type(true) == CollocationModelType.REPLICATED)
             return true;
 
-        return upper != null && upper.previousReplicated(filter);
+        return upper != null && upper.isPreviousTableReplicated(filter);
     }
 
     /**
@@ -360,7 +372,7 @@ public final class CollocationModel {
      * @return Affinity join type.
      */
     @SuppressWarnings("ForLoopReplaceableByForEach")
-    private Affinity joinedWithCollocated(int f) {
+    private CollocationModelAffinity joinedWithCollocated(int f) {
         TableFilter tf = childFilters[f];
 
         GridH2Table tbl = (GridH2Table)tf.getTable();
@@ -410,10 +422,10 @@ public final class CollocationModel {
                             // the found affinity column is the needed one, since we can select multiple
                             // different affinity columns from different tables.
                             if (cm != null && !cm.view) {
-                                Type t = cm.type(true);
+                                CollocationModelType t = cm.type(true);
 
                                 if (t.isPartitioned() && t.isCollocated() && isAffinityColumn(prevJoin, expCol, validate))
-                                    return Affinity.COLLOCATED_JOIN;
+                                    return CollocationModelAffinity.COLLOCATED_JOIN;
                             }
                         }
                     }
@@ -421,7 +433,7 @@ public final class CollocationModel {
             }
         }
 
-        return affKeyCondFound ? Affinity.HAS_AFFINITY_CONDITION : Affinity.NONE;
+        return affKeyCondFound ? CollocationModelAffinity.HAS_AFFINITY_CONDITION : CollocationModelAffinity.NONE;
     }
 
     /**
@@ -443,6 +455,7 @@ public final class CollocationModel {
      * @param validate Query validation flag.
      * @return {@code true} It it is an affinity column.
      */
+    @SuppressWarnings("IfMayBeConditional")
     private static boolean isAffinityColumn(TableFilter f, ExpressionColumn expCol, boolean validate) {
         Column col = expCol.getColumn();
 
@@ -540,26 +553,26 @@ public final class CollocationModel {
      * @param withUnion With respect to union.
      * @return Type.
      */
-    private Type type(boolean withUnion) {
+    private CollocationModelType type(boolean withUnion) {
         calculate();
 
         assert type != null;
 
         if (withUnion && unions != null) {
-            Type left = unions.get(0).type(false);
+            CollocationModelType left = unions.get(0).type(false);
 
             for (int i = 1; i < unions.size(); i++) {
-                Type right = unions.get(i).type(false);
+                CollocationModelType right = unions.get(i).type(false);
 
                 if (!left.isCollocated() || !right.isCollocated()) {
-                    left = Type.PARTITIONED_NOT_COLLOCATED;
+                    left = CollocationModelType.PARTITIONED_NOT_COLLOCATED;
 
                     break;
                 }
                 else if (!left.isPartitioned() && !right.isPartitioned())
-                    left = Type.REPLICATED;
+                    left = CollocationModelType.REPLICATED;
                 else
-                    left = Type.PARTITIONED_COLLOCATED;
+                    left = CollocationModelType.PARTITIONED_COLLOCATED;
             }
 
             return left;
@@ -573,6 +586,7 @@ public final class CollocationModel {
      * @param create Create child if needed.
      * @return Child collocation.
      */
+    @SuppressWarnings("IfMayBeConditional")
     private CollocationModel child(int i, boolean create) {
         CollocationModel child = children[i];
 
@@ -686,7 +700,7 @@ public final class CollocationModel {
     public static boolean isCollocated(Query qry) {
         CollocationModel mdl = buildCollocationModel(null, -1, qry, null, true);
 
-        Type type = mdl.type(true);
+        CollocationModelType type = mdl.type(true);
 
         if (!type.isCollocated() && mdl.multiplier == CollocationModelMultiplier.REPLICATED_NOT_LAST)
             throw new CacheException("Failed to execute query: for distributed join " +
@@ -730,7 +744,7 @@ public final class CollocationModel {
         for (TableFilter f = select.getTopTableFilter(); f != null; f = f.getJoin())
             list.add(f);
 
-        TableFilter[] filters = list.toArray(new TableFilter[list.size()]);
+        TableFilter[] filters = list.toArray(EMPTY_FILTERS);
 
         CollocationModel cm = createChildModel(upper, filter, unions, true, validate);
 
@@ -757,75 +771,4 @@ public final class CollocationModel {
             "with custom AffinityKeyMapper configured. " +
             "Please use AffinityKeyMapped annotation instead [cache=" + cacheName + ']');
     }
-
-    /**
-     * Collocation type.
-     */
-    private enum Type {
-        /** */
-        PARTITIONED_COLLOCATED(true, true),
-
-        /** */
-        PARTITIONED_NOT_COLLOCATED(true, false),
-
-        /** */
-        REPLICATED(false, true);
-
-        /** */
-        private final boolean partitioned;
-
-        /** */
-        private final boolean collocated;
-
-        /**
-         * @param partitioned Partitioned.
-         * @param collocated Collocated.
-         */
-        Type(boolean partitioned, boolean collocated) {
-            this.partitioned = partitioned;
-            this.collocated = collocated;
-        }
-
-        /**
-         * @return {@code true} If partitioned.
-         */
-        public boolean isPartitioned() {
-            return partitioned;
-        }
-
-        /**
-         * @return {@code true} If collocated.
-         */
-        public boolean isCollocated() {
-            return collocated;
-        }
-
-        /**
-         * @param partitioned Partitioned.
-         * @param collocated Collocated.
-         * @return Type.
-         */
-        static Type of(boolean partitioned, boolean collocated) {
-            if (collocated)
-                return partitioned ? Type.PARTITIONED_COLLOCATED : Type.REPLICATED;
-
-            assert partitioned;
-
-            return Type.PARTITIONED_NOT_COLLOCATED;
-        }
-    }
-
-    /**
-     * Affinity of a table relative to previous joined tables.
-     */
-    private enum Affinity {
-        /** */
-        NONE,
-
-        /** */
-        HAS_AFFINITY_CONDITION,
-
-        /** */
-        COLLOCATED_JOIN
-    }
 }
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelAffinity.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelAffinity.java
new file mode 100644
index 0000000..07740ad
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelAffinity.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query.h2.opt.join;
+
+/**
+ * Affinity of a table relative to previous joined tables.
+ */
+public enum CollocationModelAffinity {
+    /** */
+    NONE,
+
+    /** */
+    HAS_AFFINITY_CONDITION,
+
+    /** */
+    COLLOCATED_JOIN
+}
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelType.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelType.java
new file mode 100644
index 0000000..6a16205
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelType.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+
+package org.apache.ignite.internal.processors.query.h2.opt.join;
+
+/**
+ * Collocation type.
+ */
+public enum CollocationModelType {
+    /** */
+    PARTITIONED_COLLOCATED(true, true),
+
+    /** */
+    PARTITIONED_NOT_COLLOCATED(true, false),
+
+    /** */
+    REPLICATED(false, true);
+
+    /** */
+    private final boolean partitioned;
+
+    /** */
+    private final boolean collocated;
+
+    /**
+     * @param partitioned Partitioned.
+     * @param collocated Collocated.
+     */
+    CollocationModelType(boolean partitioned, boolean collocated) {
+        this.partitioned = partitioned;
+        this.collocated = collocated;
+    }
+
+    /**
+     * @return {@code true} If partitioned.
+     */
+    public boolean isPartitioned() {
+        return partitioned;
+    }
+
+    /**
+     * @return {@code true} If collocated.
+     */
+    public boolean isCollocated() {
+        return collocated;
+    }
+
+    /**
+     * @param partitioned Partitioned.
+     * @param collocated Collocated.
+     * @return Type.
+     */
+    public static CollocationModelType of(boolean partitioned, boolean collocated) {
+        if (collocated)
+            return partitioned ? PARTITIONED_COLLOCATED : REPLICATED;
+
+        assert partitioned;
+
+        return PARTITIONED_NOT_COLLOCATED;
+    }
+}


[ignite] 06/08: Merge with master.

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3c5c42bf66f5c8c0e46ad719f167c1d2653ab02a
Author: devozerov <vo...@gridgain.com>
AuthorDate: Mon Feb 4 11:09:33 2019 +0300

    Merge with master.
---
 .../processors/query/h2/opt/GridH2IndexBase.java       | 14 ++------------
 .../processors/query/h2/opt/join/CollocationModel.java | 18 +++++++++++-------
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index e2f06a3..4c1757e 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -38,7 +38,6 @@ import org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModel;
 import org.apache.ignite.internal.processors.query.h2.opt.join.RangeSource;
 import org.apache.ignite.internal.processors.query.h2.opt.join.RangeStream;
 import org.apache.ignite.internal.processors.query.h2.opt.join.SegmentKey;
-import org.apache.ignite.internal.processors.query.h2.sql.SplitterContext;
 import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2IndexRangeRequest;
 import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2IndexRangeResponse;
 import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage;
@@ -210,18 +209,9 @@ public abstract class GridH2IndexBase extends BaseIndex {
      * @return Multiplier.
      */
     public final int getDistributedMultiplier(Session ses, TableFilter[] filters, int filter) {
-        // We do optimizations with respect to distributed joins only on PREPARE stage only.
-        // Notice that we check for isJoinBatchEnabled, because we can do multiple different
-        // optimization passes on PREPARE stage.
-        // Query expressions can not be distributed as well.
-        SplitterContext ctx = SplitterContext.get();
+        CollocationModelMultiplier mul = CollocationModel.distributedMultiplier(ses, filters, filter);
 
-        if (!ctx.distributedJoins() || !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
-            return CollocationModelMultiplier.COLLOCATED.multiplier();
-
-        assert filters != null;
-
-        return CollocationModel.distributedMultiplier(ctx, ses, filters, filter);
+        return mul.multiplier();
     }
 
     /** {@inheritDoc} */
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index efe413c..6bbd968 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@ -629,18 +629,22 @@ public final class CollocationModel {
     /**
      * Get distributed multiplier for the given sequence of tables.
      *
-     * @param ctx Splitter context.
      * @param ses Session.
      * @param filters Filters.
      * @param filter Filter index.
      * @return Multiplier.
      */
-    public static int distributedMultiplier(
-        SplitterContext ctx,
-        Session ses,
-        TableFilter[] filters,
-        int filter
-    ) {
+    public static CollocationModelMultiplier distributedMultiplier(Session ses, TableFilter[] filters, int filter) {
+        // Notice that we check for isJoinBatchEnabled, because we can do multiple different
+        // optimization passes on PREPARE stage.
+        // Query expressions can not be distributed as well.
+        SplitterContext ctx = SplitterContext.get();
+
+        if (!ctx.distributedJoins() || !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
+            return CollocationModelMultiplier.COLLOCATED;
+
+        assert filters != null;
+
         clearViewIndexCache(ses);
 
         CollocationModel model = buildCollocationModel(ctx, ses.getSubQueryInfo(), filters, filter, false);


[ignite] 08/08: WIP.

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9dfda733fbc7523ff6c653dbf802013cf2dbdbac
Author: devozerov <vo...@gridgain.com>
AuthorDate: Mon Feb 4 11:16:33 2019 +0300

    WIP.
---
 .../internal/processors/query/h2/H2Utils.java      | 15 +++++++++++++++
 .../processors/query/h2/opt/GridH2IndexBase.java   | 22 ----------------------
 .../query/h2/opt/join/BroadcastCursor.java         |  3 ++-
 .../query/h2/twostep/GridMergeIndexSorted.java     |  4 ++--
 4 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
index 7078b43..684ecf7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
@@ -32,6 +32,7 @@ import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -728,4 +729,18 @@ public class H2Utils {
             return prepared(s);
         }
     }
+
+    /**
+     * @param arr Array.
+     * @param off Offset.
+     * @param cmp Comparator.
+     */
+    public static <Z> void bubbleUp(Z[] arr, int off, Comparator<Z> cmp) {
+        for (int i = off, last = arr.length - 1; i < last; i++) {
+            if (cmp.compare(arr[i], arr[i + 1]) <= 0)
+                break;
+
+            U.swap(arr, i, i + 1);
+        }
+    }
 }
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index fa09e69..46258b0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -67,7 +67,6 @@ import org.h2.value.Value;
 import javax.cache.CacheException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -97,12 +96,6 @@ public abstract class GridH2IndexBase extends BaseIndex {
     private IgniteLogger log;
 
     /** */
-    private final CIX2<ClusterNode,Message> locNodeHnd = new CIX2<ClusterNode,Message>() {
-        @Override public void applyx(ClusterNode clusterNode, Message msg) {
-            onMessage0(clusterNode.id(), msg);
-        }
-    };
-
     protected GridCacheContext<?, ?> ctx;
 
     /**
@@ -527,21 +520,6 @@ public abstract class GridH2IndexBase extends BaseIndex {
     }
 
     /**
-     * @param arr Array.
-     * @param off Offset.
-     * @param cmp Comparator.
-     */
-    public static <Z> void bubbleUp(Z[] arr, int off, Comparator<Z> cmp) {
-        // TODO Optimize: use binary search if the range in array is big.
-        for (int i = off, last = arr.length - 1; i < last; i++) {
-            if (cmp.compare(arr[i], arr[i + 1]) <= 0)
-                break;
-
-            U.swap(arr, i, i + 1);
-        }
-    }
-
-    /**
      * @return Index segments count.
      */
     public abstract int segmentsCount();
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/BroadcastCursor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/BroadcastCursor.java
index 632d72a..9d12028 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/BroadcastCursor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/BroadcastCursor.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.opt.join;
 
+import org.apache.ignite.internal.processors.query.h2.H2Utils;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
 import org.h2.index.Cursor;
 import org.h2.result.Row;
@@ -122,7 +123,7 @@ public class BroadcastCursor implements Cursor, Comparator<RangeStream> {
         }
 
         // Bubble up current min stream with respect to fetched row to achieve correct sort order of streams.
-        GridH2IndexBase.bubbleUp(streams, off, this);
+        H2Utils.bubbleUp(streams, off, this);
 
         return true;
     }
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexSorted.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexSorted.java
index 880e305..482752a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexSorted.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexSorted.java
@@ -32,6 +32,7 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.query.h2.H2Utils;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Cursor;
 import org.apache.ignite.internal.processors.query.h2.opt.H2PlainRowFactory;
 import org.apache.ignite.internal.util.typedef.F;
@@ -49,7 +50,6 @@ import org.h2.value.Value;
 import org.jetbrains.annotations.Nullable;
 
 import static java.util.Collections.emptyIterator;
-import static org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase.bubbleUp;
 
 /**
  * Sorted index.
@@ -258,7 +258,7 @@ public final class GridMergeIndexSorted extends GridMergeIndex {
                 return; // All streams are done.
 
             if (streams[off].next())
-                bubbleUp(streams, off, streamCmp);
+                H2Utils.bubbleUp(streams, off, streamCmp);
             else
                 streams[off++] = null; // Move left bound and nullify empty stream.
         }


[ignite] 01/08: Converted multiplier to enum.

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 160e04c0580f7a50fae9403ddcb45e4e08675445
Author: devozerov <vo...@gridgain.com>
AuthorDate: Fri Feb 1 17:40:33 2019 +0300

    Converted multiplier to enum.
---
 .../processors/query/h2/opt/GridH2IndexBase.java   |  3 +-
 .../query/h2/opt/join/CollocationModel.java        | 54 +++++++++-------------
 .../h2/opt/join/CollocationModelMultiplier.java    | 54 ++++++++++++++++++++++
 3 files changed, 78 insertions(+), 33 deletions(-)

diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index ab9929d..f353aff 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
 import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.processors.query.h2.H2Cursor;
 import org.apache.ignite.internal.processors.query.h2.H2Utils;
+import org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModelMultiplier;
 import org.apache.ignite.internal.processors.query.h2.opt.join.CursorIteratorWrapper;
 import org.apache.ignite.internal.processors.query.h2.opt.join.DistributedLookupBatch;
 import org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModel;
@@ -229,7 +230,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
         // Query expressions can not be distributed as well.
         if (qctx == null || qctx.type() != PREPARE || qctx.distributedJoinMode() == OFF ||
             !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
-            return CollocationModel.MULTIPLIER_COLLOCATED;
+            return CollocationModelMultiplier.MULTIPLIER_COLLOCATED.multiplier();
 
         // We have to clear this cache because normally sub-query plan cost does not depend on anything
         // other than index condition masks and sort order, but in our case it can depend on order
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index 03653c7..95895fe 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@ -47,18 +47,6 @@ import org.h2.table.TableView;
  */
 public final class CollocationModel {
     /** */
-    public static final int MULTIPLIER_COLLOCATED = 1;
-
-    /** */
-    private static final int MULTIPLIER_UNICAST = 50;
-
-    /** */
-    private static final int MULTIPLIER_BROADCAST = 200;
-
-    /** */
-    private static final int MULTIPLIER_REPLICATED_NOT_LAST = 10_000;
-
-    /** */
     private final CollocationModel upper;
 
     /** */
@@ -68,7 +56,7 @@ public final class CollocationModel {
     private final boolean view;
 
     /** */
-    private int multiplier;
+    private CollocationModelMultiplier multiplier;
 
     /** */
     private Type type;
@@ -234,7 +222,7 @@ public final class CollocationModel {
 
         // Reset results.
         type = null;
-        multiplier = 0;
+        multiplier = null;
 
         return true;
     }
@@ -252,14 +240,14 @@ public final class CollocationModel {
 
             boolean collocated = true;
             boolean partitioned = false;
-            int maxMultiplier = MULTIPLIER_COLLOCATED;
+            CollocationModelMultiplier maxMultiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
 
             for (int i = 0; i < childFilters.length; i++) {
                 CollocationModel child = child(i, true);
 
                 Type t = child.type(true);
 
-                if (child.multiplier == MULTIPLIER_REPLICATED_NOT_LAST)
+                if (child.multiplier == CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
                     maxMultiplier = child.multiplier;
 
                 if (t.isPartitioned()) {
@@ -268,12 +256,12 @@ public final class CollocationModel {
                     if (!t.isCollocated()) {
                         collocated = false;
 
-                        int m = child.multiplier(true);
+                        CollocationModelMultiplier m = child.multiplier(true);
 
-                        if (m > maxMultiplier) {
+                        if (m.multiplier() > maxMultiplier.multiplier()) {
                             maxMultiplier = m;
 
-                            if (maxMultiplier == MULTIPLIER_REPLICATED_NOT_LAST)
+                            if (maxMultiplier == CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
                                 break;
                         }
                     }
@@ -293,7 +281,7 @@ public final class CollocationModel {
             // Only partitioned tables will do distributed joins.
             if (!(tbl instanceof GridH2Table) || !((GridH2Table)tbl).isPartitioned()) {
                 type = Type.REPLICATED;
-                multiplier = MULTIPLIER_COLLOCATED;
+                multiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
 
                 return;
             }
@@ -303,7 +291,7 @@ public final class CollocationModel {
             // to all the affinity nodes the "base" does not need to get remote results.
             if (!upper.findPartitionedTableBefore(filter)) {
                 type = Type.PARTITIONED_COLLOCATED;
-                multiplier = MULTIPLIER_COLLOCATED;
+                multiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
             }
             else {
                 // It is enough to make sure that our previous join by affinity key is collocated, then we are
@@ -311,19 +299,19 @@ public final class CollocationModel {
                 switch (upper.joinedWithCollocated(filter)) {
                     case COLLOCATED_JOIN:
                         type = Type.PARTITIONED_COLLOCATED;
-                        multiplier = MULTIPLIER_COLLOCATED;
+                        multiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
 
                         break;
 
                     case HAS_AFFINITY_CONDITION:
                         type = Type.PARTITIONED_NOT_COLLOCATED;
-                        multiplier = MULTIPLIER_UNICAST;
+                        multiplier = CollocationModelMultiplier.MULTIPLIER_UNICAST;
 
                         break;
 
                     case NONE:
                         type = Type.PARTITIONED_NOT_COLLOCATED;
-                        multiplier = MULTIPLIER_BROADCAST;
+                        multiplier = CollocationModelMultiplier.MULTIPLIER_BROADCAST;
 
                         break;
 
@@ -333,7 +321,7 @@ public final class CollocationModel {
             }
 
             if (upper.previousReplicated(filter))
-                multiplier = MULTIPLIER_REPLICATED_NOT_LAST;
+                multiplier = CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST;
         }
     }
 
@@ -517,7 +505,7 @@ public final class CollocationModel {
      */
     public int calculateMultiplier() {
         // We don't need multiplier for union here because it will be summarized in H2.
-        return multiplier(false);
+        return multiplier(false).multiplier();
     }
 
     /**
@@ -525,21 +513,23 @@ public final class CollocationModel {
      * @return Multiplier.
      */
     @SuppressWarnings("ForLoopReplaceableByForEach")
-    private int multiplier(boolean withUnion) {
+    private CollocationModelMultiplier multiplier(boolean withUnion) {
         calculate();
 
-        assert multiplier != 0;
+        assert multiplier != null;
 
         if (withUnion && unions != null) {
-            int maxMultiplier = 0;
+            CollocationModelMultiplier maxMultiplier = null;
 
             for (int i = 0; i < unions.size(); i++) {
-                int m = unions.get(i).multiplier(false);
+                CollocationModelMultiplier m = unions.get(i).multiplier(false);
 
-                if (m > maxMultiplier)
+                if (maxMultiplier == null || m.multiplier() > maxMultiplier.multiplier())
                     maxMultiplier = m;
             }
 
+            assert maxMultiplier != null;
+
             return maxMultiplier;
         }
 
@@ -698,7 +688,7 @@ public final class CollocationModel {
 
         Type type = mdl.type(true);
 
-        if (!type.isCollocated() && mdl.multiplier == MULTIPLIER_REPLICATED_NOT_LAST)
+        if (!type.isCollocated() && mdl.multiplier == CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
             throw new CacheException("Failed to execute query: for distributed join " +
                 "all REPLICATED caches must be at the end of the joined tables list.");
 
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelMultiplier.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelMultiplier.java
new file mode 100644
index 0000000..d173542
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelMultiplier.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query.h2.opt.join;
+
+/**
+ * Multiplier for different collocation types.
+ */
+public enum CollocationModelMultiplier {
+    /** Tables are collocated, cheap. */
+    MULTIPLIER_COLLOCATED(1),
+
+    /** */
+    MULTIPLIER_UNICAST(50),
+
+    /** */
+    MULTIPLIER_BROADCAST(200),
+
+    /** Force REPLICATED tables to be at the end of join sequence. */
+    MULTIPLIER_REPLICATED_NOT_LAST(10_000);
+
+    /** Multiplier value. */
+    private final int multiplier;
+
+    /**
+     * Constructor.
+     *
+     * @param multiplier Multiplier value.
+     */
+    CollocationModelMultiplier(int multiplier) {
+        this.multiplier = multiplier;
+    }
+
+    /**
+     * @return Multiplier value.
+     */
+    public int multiplier() {
+        return multiplier;
+    }
+}


[ignite] 04/08: Merge branch 'master' into col_model

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 896bc2303b46282bc58ad88ef88843f5ccb6a6e8
Merge: 3b21ea7 ef04782
Author: devozerov <vo...@gridgain.com>
AuthorDate: Mon Feb 4 11:04:07 2019 +0300

    Merge branch 'master' into col_model

 .../ParametricVectorGeneratorExample.java          |  65 ++++++++
 .../util/generators/StandardGeneratorsExample.java |  75 +++++++++
 .../generators/VectorGeneratorFamilyExample.java   |  65 ++++++++
 .../VectorGeneratorPrimitivesExample.java          |  97 +++++++++++
 .../examples/ml/util/generators/package-info.java  |  17 +-
 .../processors/cache/GridCacheProcessor.java       |   8 +-
 .../processors/cache/mvcc/MvccProcessor.java       |  12 ++
 .../processors/cache/mvcc/MvccProcessorImpl.java   |  32 +++-
 .../GridCacheDatabaseSharedManager.java            |  21 ++-
 .../processors/cache/CacheMetricsManageTest.java   |   2 +-
 .../cache/CacheNearReaderUpdateTest.java           |   2 +-
 .../cache/CacheNoAffinityExchangeTest.java         |   2 +-
 .../processors/cache/CacheRebalancingSelfTest.java |   2 +-
 .../cache/GridCacheBasicApiAbstractTest.java       |  30 ++--
 .../cache/GridCacheEntryMemorySizeSelfTest.java    |   4 +-
 ...CacheInterceptorTransactionalRebalanceTest.java |   2 +-
 .../cache/GridCachePartitionedGetSelfTest.java     |   2 +-
 .../cache/GridCachePartitionedWritesTest.java      |   2 +-
 .../GridCachePreloadingEvictionsSelfTest.java      |   2 +-
 .../cache/GridCacheReferenceCleanupSelfTest.java   |  13 +-
 .../cache/GridCacheTtlManagerEvictionSelfTest.java |   4 +-
 .../GridCacheValueConsistencyAbstractSelfTest.java |   4 +-
 ...IgniteCacheInvokeReadThroughSingleNodeTest.java |   5 +-
 .../cache/IgniteCacheInvokeReadThroughTest.java    |   5 +-
 .../IgniteCacheReadThroughEvictionSelfTest.java    |  21 ++-
 .../cache/IgniteClusterActivateDeactivateTest.java |   6 -
 ...teDynamicCacheStartFailWithPersistenceTest.java |   7 -
 .../cache/WalModeChangeAbstractSelfTest.java       |   4 +-
 .../cache/WalModeChangeAdvancedSelfTest.java       |   4 -
 .../CacheDataLossOnPartitionMoveTest.java          |   4 -
 .../CacheLoadingConcurrentGridStartSelfTest.java   |   2 +-
 .../distributed/CacheLockReleaseNodeLeaveTest.java |   2 +-
 .../distributed/CacheTryLockMultithreadedTest.java |   2 +-
 .../GridCacheAbstractPrimarySyncSelfTest.java      |   2 +-
 .../distributed/GridCacheBasicOpAbstractTest.java  |   4 +-
 .../GridCacheMultiNodeAbstractTest.java            |   6 +-
 .../GridCacheMultiNodeLockAbstractTest.java        |   4 +-
 .../GridCacheNodeFailureAbstractTest.java          |   2 +-
 .../GridCachePartitionNotLoadedEventSelfTest.java  |   2 +-
 .../GridCachePreloadEventsAbstractSelfTest.java    |   2 +-
 .../GridCachePreloadRestartAbstractSelfTest.java   |   2 +-
 .../IgniteCacheClientNodeChangingTopologyTest.java |   2 +-
 .../IgniteTxRemoveTimeoutObjectsTest.java          |   2 +-
 .../distributed/dht/GridCacheDhtEntrySelfTest.java |   2 +-
 .../dht/GridCacheDhtMappingSelfTest.java           |   2 +-
 .../dht/GridCacheDhtPreloadDisabledSelfTest.java   |   2 +-
 .../GridCacheDhtPreloadMultiThreadedSelfTest.java  |   2 +-
 .../near/GridCacheNearMetricsSelfTest.java         |   2 +-
 .../near/GridCacheNearOnlyTopologySelfTest.java    |   2 +-
 .../GridCacheNearPartitionedClearSelfTest.java     |   2 +-
 .../near/GridCacheNearReaderPreloadSelfTest.java   |   2 +-
 .../near/GridCacheNearReadersSelfTest.java         |   2 +-
 .../near/GridCachePartitionedEventSelfTest.java    |   2 +-
 ...PartitionedExplicitLockNodeFailureSelfTest.java |   2 +-
 .../GridCachePartitionedHitsAndMissesSelfTest.java |   2 +-
 .../GridCachePartitionedLoadCacheSelfTest.java     |   2 +-
 .../near/GridNearCacheStoreUpdateTest.java         |   4 +-
 ...dCacheRebalancingWithAsyncClearingMvccTest.java |   6 +-
 .../GridCacheReplicatedPreloadSelfTest.java        |   4 +-
 .../cache/eviction/DhtAndNearEvictionTest.java     |   2 +-
 .../GridCacheEmptyEntriesLocalSelfTest.java        |   4 +-
 .../GridCacheEmptyEntriesPartitionedSelfTest.java  |   2 +-
 .../eviction/GridCacheEvictionFilterSelfTest.java  |   4 +-
 .../local/GridCacheDaemonNodeLocalSelfTest.java    |   2 +-
 .../local/GridCacheLocalIsolatedNodesSelfTest.java |   2 +-
 .../cache/mvcc/CacheMvccAbstractTest.java          |   6 +
 .../processors/cache/mvcc/CacheMvccVacuumTest.java | 184 ++++++++++++++++++++-
 ...tePdsContinuousRestartTestWithExpiryPolicy.java |   2 +-
 .../IgnitePdsPartitionFilesDestroyTest.java        |   4 -
 ...gniteRebalanceScheduleResendPartitionsTest.java |   4 -
 ...ocalWalModeChangeDuringRebalancingSelfTest.java |  13 --
 ...NoChangeDuringRebalanceOnNonNodeAssignTest.java |   6 +-
 ...itePdsPageEvictionDuringPartitionClearTest.java |   4 -
 ...gnitePdsRebalancingOnNotStableTopologyTest.java |   4 -
 .../cache/persistence/db/IgnitePdsWithTtlTest.java |   2 +-
 .../persistence/db/IgnitePdsWithTtlTest2.java      |   2 +-
 .../wal/IgniteNodeStoppedDuringDisableWALTest.java |   9 +-
 .../db/wal/IgniteWalHistoryReservationsTest.java   |   4 +-
 .../CacheEntryProcessorNonSerializableTest.java    |   2 +-
 ...iteBehindStorePartitionedMultiNodeSelfTest.java |   2 +-
 .../transactions/TxRollbackAsyncNearCacheTest.java |   2 +-
 .../database/IgniteDbDynamicCacheSelfTest.java     |   4 -
 .../database/IgniteDbPutGetWithCacheStoreTest.java |   2 +-
 .../datastreamer/DataStreamProcessorSelfTest.java  |   8 +-
 .../ignite/testframework/MvccFeatureChecker.java   |  29 +---
 .../java/org/apache/ignite/ml/math/Tracer.java     | 141 +++++++++++++++-
 .../apache/ignite/ml/math/d3-dataset-template.html | 112 +++++++++++++
 .../org/apache/ignite/ml/IgniteMLTestSuite.java    |   2 +
 .../generators/DataStreamGeneratorTestSuite.java   |  49 ++++++
 89 files changed, 971 insertions(+), 235 deletions(-)


[ignite] 05/08: Merge branch 'master' into col_model

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 353fe5307b31f652aea43b05e118075d76091e47
Merge: 896bc23 1602cc7
Author: devozerov <vo...@gridgain.com>
AuthorDate: Mon Feb 4 11:05:53 2019 +0300

    Merge branch 'master' into col_model
    
    # Conflicts:
    #	modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
    #	modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java

 .../testframework/util/MavenUtils.java             |  22 +-
 .../transactions/PlatformTransactions.java         |   2 +
 .../processors/database/BPlusTreeSelfTest.java     |  28 +-
 .../processors/query/h2/IgniteH2Indexing.java      |  48 +-
 .../processors/query/h2/opt/GridH2IndexBase.java   |  52 +--
 .../query/h2/opt/GridH2QueryContext.java           | 290 +-----------
 .../processors/query/h2/opt/GridH2QueryType.java   |   7 +-
 .../query/h2/opt/join/CollocationModel.java        |  70 ++-
 .../query/h2/opt/join/DistributedJoinContext.java  | 263 +++++++++++
 .../query/h2/opt/join/DistributedJoinMode.java     |  51 ---
 .../query/h2/opt/join/DistributedLookupBatch.java  |  64 +--
 .../processors/query/h2/opt/join/RangeStream.java  |  13 +-
 .../query/h2/sql/GridSqlQuerySplitter.java         |  43 ++
 .../processors/query/h2/sql/SplitterContext.java   |  85 ++++
 .../query/h2/twostep/GridMapQueryExecutor.java     | 118 +++--
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  13 +-
 .../persistence/db/IgniteTcBotInitNewPageTest.java |  13 +-
 .../Cache/CacheTimeoutOnPmeTransactionalTest.cs    | 108 +++--
 .../Apache.Ignite.Core/IgniteConfiguration.cs      |   2 +-
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs       |   2 +-
 .../Impl/Transactions/Transaction.cs               |   6 +
 .../Impl/Transactions/TransactionImpl.cs           |  15 +-
 .../Impl/Transactions/TransactionsImpl.cs          |  14 +-
 .../Transactions/ITransaction.cs                   |   8 +
 modules/web-console/frontend/app/app.d.ts          |   2 +-
 modules/web-console/frontend/app/app.js            | 498 ++++++++++-----------
 .../components/form-field-size/controller.ts       |  23 +-
 .../form-field/igniteFormField.directive.ts        |  76 ++++
 .../frontend/app/components/form-field/index.js    |   2 +
 .../frontend/app/components/page-admin/index.js    |   2 +-
 .../components/cache-edit-form/index.js            |  21 -
 .../components/cluster-edit-form/index.js          |  21 -
 .../components/model-edit-form/index.js            |  21 -
 .../page-configure/components/pcValidation.ts      | 197 --------
 .../app/components/page-configure/index.d.ts       | 154 -------
 .../components/page-configure/types/uirouter.d.ts  |  20 -
 .../ignite-information}/information.directive.js   |   0
 .../components/ignite-information}/information.pug |   0
 .../ignite-information}/information.scss           |   0
 .../components/queries-notebook/index.js           |   2 +
 .../frontend/app/components/page-queries/index.ts  |   2 +-
 .../button-download-project/component.ts}          |   9 +-
 .../components/button-download-project/index.ts}   |   0
 .../button-download-project/template.pug           |   0
 .../components/button-import-models/component.ts}  |  11 +-
 .../components/button-import-models/index.ts}      |   4 +-
 .../components/button-import-models/style.scss     |   0
 .../components/button-import-models/template.pug   |   0
 .../button-preview-project/component.ts}           |   9 +-
 .../components/button-preview-project/index.ts}    |   4 +-
 .../components/button-preview-project/template.pug |   0
 .../components/fakeUICanExit.spec.js               |   0
 .../components/fakeUICanExit.ts}                   |  15 +-
 .../components/formUICanExitGuard.ts}              |   9 +-
 .../components/modal-import-models/component.js    |   6 +-
 .../components/modal-import-models/index.ts}       |   0
 .../selected-items-amount-indicator/component.ts}  |   0
 .../selected-items-amount-indicator/style.scss     |   1 -
 .../selected-items-amount-indicator/template.pug   |   0
 .../components/modal-import-models/service.ts}     |  21 +-
 .../step-indicator/component.ts}                   |   8 +-
 .../modal-import-models/step-indicator/style.scss  |   1 -
 .../step-indicator/template.pug                    |   0
 .../components/modal-import-models/style.scss      |   0
 .../tables-action-cell/component.ts}               |  13 +-
 .../tables-action-cell/style.scss                  |   0
 .../tables-action-cell/template.pug                |   0
 .../modal-import-models/template.tpl.pug           |   1 +
 .../components/modal-preview-project/component.ts} |   0
 .../modal-preview-project/controller.ts}           |  33 +-
 .../components/modal-preview-project/index.ts}     |   0
 .../components/modal-preview-project/service.ts}   |  18 +-
 .../components/modal-preview-project/style.scss    |   3 +-
 .../components/modal-preview-project/template.pug  |   0
 .../page-configure-advanced/component.ts}          |   0
 .../components/cache-edit-form/component.ts}       |   0
 .../components/cache-edit-form/controller.ts}      |  37 +-
 .../components/cache-edit-form/index.ts}           |   4 +-
 .../components/cache-edit-form}/style.scss         |   0
 .../components/cache-edit-form/template.tpl.pug    |   0
 .../cache-edit-form/templates/affinity.pug         |   1 +
 .../cache-edit-form/templates/concurrency.pug      |   1 +
 .../cache-edit-form/templates/general.pug          |   1 +
 .../cache-edit-form/templates/memory.pug           |   1 +
 .../templates/near-cache-client.pug                |   1 +
 .../templates/near-cache-server.pug                |   1 +
 .../cache-edit-form/templates/node-filter.pug      |   1 +
 .../components/cache-edit-form/templates/query.pug |   1 +
 .../cache-edit-form/templates/rebalance.pug        |   1 +
 .../cache-edit-form/templates/statistics.pug       |   1 +
 .../components/cache-edit-form/templates/store.pug |   1 +
 .../components/cluster-edit-form/component.ts}     |   0
 .../cluster-edit-form/controller.spec.js           |   0
 .../components/cluster-edit-form/controller.ts}    |  43 +-
 .../components/cluster-edit-form/index.ts}         |   5 +-
 .../components/cluster-edit-form}/style.scss       |   0
 .../components/cluster-edit-form/template.tpl.pug  |   0
 .../cluster-edit-form/templates/atomic.pug         |   1 +
 .../cluster-edit-form/templates/attributes.pug     |   1 +
 .../cluster-edit-form/templates/binary.pug         |   1 +
 .../cluster-edit-form/templates/cache-key-cfg.pug  |   1 +
 .../cluster-edit-form/templates/checkpoint.pug     |   1 +
 .../cluster-edit-form/templates/checkpoint/fs.pug  |   0
 .../templates/checkpoint/jdbc.pug                  |   0
 .../cluster-edit-form/templates/checkpoint/s3.pug  |   0
 .../templates/client-connector.pug                 |   1 +
 .../cluster-edit-form/templates/collision.pug      |   1 +
 .../templates/collision/custom.pug                 |   0
 .../templates/collision/fifo-queue.pug             |   0
 .../templates/collision/job-stealing.pug           |   0
 .../templates/collision/priority-queue.pug         |   0
 .../cluster-edit-form/templates/communication.pug  |   1 +
 .../cluster-edit-form/templates/connector.pug      |   1 +
 .../cluster-edit-form/templates/data-storage.pug   |   1 +
 .../cluster-edit-form/templates/deployment.pug     |   1 +
 .../cluster-edit-form/templates/discovery.pug      |   1 +
 .../cluster-edit-form/templates/events.pug         |   1 +
 .../cluster-edit-form/templates/failover.pug       |   1 +
 .../cluster-edit-form/templates/general.pug        |   1 +
 .../templates/general/discovery/cloud.pug          |   0
 .../templates/general/discovery/google.pug         |   0
 .../templates/general/discovery/jdbc.pug           |   0
 .../templates/general/discovery/kubernetes.pug     |   0
 .../templates/general/discovery/multicast.pug      |   0
 .../templates/general/discovery/s3.pug             |   0
 .../templates/general/discovery/shared.pug         |   0
 .../templates/general/discovery/vm.pug             |   0
 .../templates/general/discovery/zookeeper.pug      |   0
 .../retrypolicy/bounded-exponential-backoff.pug    |   0
 .../discovery/zookeeper/retrypolicy/custom.pug     |   0
 .../zookeeper/retrypolicy/exponential-backoff.pug  |   0
 .../discovery/zookeeper/retrypolicy/forever.pug    |   0
 .../discovery/zookeeper/retrypolicy/n-times.pug    |   0
 .../discovery/zookeeper/retrypolicy/one-time.pug   |   0
 .../zookeeper/retrypolicy/until-elapsed.pug        |   0
 .../cluster-edit-form/templates/hadoop.pug         |   1 +
 .../cluster-edit-form/templates/load-balancing.pug |   1 +
 .../cluster-edit-form/templates/logger.pug         |   1 +
 .../cluster-edit-form/templates/logger/custom.pug  |   0
 .../cluster-edit-form/templates/logger/log4j.pug   |   0
 .../cluster-edit-form/templates/logger/log4j2.pug  |   0
 .../cluster-edit-form/templates/marshaller.pug     |   1 +
 .../cluster-edit-form/templates/memory.pug         |   1 +
 .../cluster-edit-form/templates/metrics.pug        |   1 +
 .../cluster-edit-form/templates/misc.pug           |   1 +
 .../cluster-edit-form/templates/mvcc.pug           |   1 +
 .../cluster-edit-form/templates/odbc.pug           |   1 +
 .../cluster-edit-form/templates/persistence.pug    |   1 +
 .../cluster-edit-form/templates/service.pug        |   1 +
 .../cluster-edit-form/templates/sql-connector.pug  |   1 +
 .../components/cluster-edit-form/templates/ssl.pug |   1 +
 .../cluster-edit-form/templates/swap.pug           |   1 +
 .../cluster-edit-form/templates/thread.pug         |   1 +
 .../cluster-edit-form/templates/time.pug           |   1 +
 .../cluster-edit-form/templates/transactions.pug   |   1 +
 .../components/igfs-edit-form/component.ts}        |   0
 .../components/igfs-edit-form/controller.ts}       |  20 +-
 .../components/igfs-edit-form/index.ts}            |   5 +-
 .../components/igfs-edit-form/style.scss           |   0
 .../components/igfs-edit-form/template.tpl.pug     |   0
 .../components/igfs-edit-form/templates/dual.pug   |   1 +
 .../igfs-edit-form/templates/fragmentizer.pug      |   1 +
 .../igfs-edit-form/templates/general.pug           |   1 +
 .../components/igfs-edit-form/templates/ipc.pug    |   1 +
 .../components/igfs-edit-form/templates/misc.pug   |   1 +
 .../igfs-edit-form/templates/secondary.pug         |   1 +
 .../components/model-edit-form/component.js        |   0
 .../components/model-edit-form/controller.ts}      |  71 ++-
 .../components/model-edit-form}/index.js           |   5 +-
 .../components/model-edit-form/style.scss          |   0
 .../components/model-edit-form/template.tpl.pug    |   0
 .../model-edit-form/templates/general.pug          |   1 +
 .../components/model-edit-form/templates/query.pug |   1 +
 .../components/model-edit-form/templates/store.pug |   1 +
 .../page-configure-advanced-caches/component.ts}   |   0
 .../page-configure-advanced-caches/controller.ts}  | 132 +++---
 .../page-configure-advanced-caches/index.ts}       |   0
 .../page-configure-advanced-caches/template.pug    |   0
 .../page-configure-advanced-cluster/component.ts}  |   0
 .../page-configure-advanced-cluster/controller.ts} |  22 +-
 .../page-configure-advanced-cluster/index.ts}      |   0
 .../page-configure-advanced-cluster/template.pug   |   0
 .../page-configure-advanced-igfs/component.ts}     |   0
 .../page-configure-advanced-igfs/controller.ts}    |  43 +-
 .../page-configure-advanced-igfs/index.ts}         |   0
 .../page-configure-advanced-igfs/template.pug      |   0
 .../page-configure-advanced-models/component.ts}   |   0
 .../page-configure-advanced-models/controller.ts}  |  55 ++-
 .../hasIndex.template.pug                          |   0
 .../page-configure-advanced-models/index.ts}       |   0
 .../keyCell.template.pug                           |   0
 .../page-configure-advanced-models/style.scss      |   0
 .../page-configure-advanced-models/template.pug    |   0
 .../valueCell.template.pug                         |   0
 .../page-configure-advanced/controller.ts}         |   2 +
 .../components/page-configure-advanced/index.ts}   |   0
 .../components/page-configure-advanced/style.scss  |   3 +-
 .../page-configure-advanced/template.pug           |   0
 .../components/page-configure-basic/component.ts}  |   0
 .../page-configure-basic/controller.spec.js        |   0
 .../components/page-configure-basic/controller.ts} |  56 +--
 .../components/page-configure-basic/index.ts}      |   0
 .../page-configure-basic/reducer.spec.js           |   0
 .../components/page-configure-basic/reducer.ts}    |   0
 .../components/page-configure-basic/style.scss     |   0
 .../components/page-configure-basic/template.pug   |   1 +
 .../page-configure-overview/component.ts}          |   0
 .../pco-grid-column-categories/directive.ts}       |   9 +-
 .../page-configure-overview/controller.ts}         |  55 ++-
 .../components/page-configure-overview/index.ts}   |   0
 .../components/page-configure-overview/style.scss  |   0
 .../page-configure-overview/template.pug           |   0
 .../components/page-configure/component.ts}        |   0
 .../components/page-configure/controller.ts}       |  27 +-
 .../components/page-configure/index.ts}            |   6 +-
 .../components/page-configure/style.scss           |   2 -
 .../components/page-configure/template.pug         |   0
 .../components/pc-items-table/component.js         |   0
 .../components/pc-items-table/controller.js        |   0
 .../components/pc-items-table/decorator.js         |   0
 .../components/pc-items-table/index.js             |   0
 .../components/pc-items-table/style.scss           |   2 +-
 .../components/pc-items-table/template.pug         |   0
 .../components/pc-split-button/component.ts}       |   0
 .../components/pc-split-button/controller.ts}      |  19 +-
 .../components/pc-split-button/index.ts}           |   0
 .../components/pc-split-button/template.pug        |   0
 .../components/pc-ui-grid-filters/directive.ts}    |   5 +-
 .../components/pc-ui-grid-filters/index.ts}        |   0
 .../components/pc-ui-grid-filters/style.scss       |   0
 .../components/pc-ui-grid-filters/template.pug     |   0
 .../components/pcIsInCollection.ts}                |   5 +-
 .../app/configuration/components/pcValidation.ts   | 117 +++++
 .../components/preview-panel/directive.ts}         |  10 +-
 .../components/preview-panel/index.ts}             |   0
 .../components/ui-ace-java/index.ts}               |   2 +-
 .../ui-ace-java/ui-ace-java.controller.ts}         |   0
 .../ui-ace-java/ui-ace-java.directive.ts}          |   0
 .../components}/ui-ace-java/ui-ace-java.pug        |   0
 .../components/ui-ace-spring/index.ts}             |   2 +-
 .../ui-ace-spring/ui-ace-spring.controller.ts}     |   0
 .../ui-ace-spring/ui-ace-spring.directive.ts}      |   0
 .../components}/ui-ace-spring/ui-ace-spring.pug    |   0
 .../components/ui-ace-tabs.directive.ts}           |   0
 .../components}/ui-ace.controller.js               |   0
 .../defaultNames.ts}                               |   0
 .../generator/JavaTypesNonEnum.service.spec.ts     |  38 ++
 .../generator/JavaTypesNonEnum.service.ts          |  62 +++
 .../generator}/configuration.module.js             |  42 +-
 .../generator}/generator/AbstractTransformer.js    |   4 +-
 .../generator}/generator/Beans.js                  |   0
 .../generator}/generator/ConfigurationGenerator.js |   0
 .../generator}/generator/Custom.service.js         |   0
 .../generator}/generator/Docker.service.js         |   0
 .../generator}/generator/Docker.service.spec.js    |   0
 .../generator/JavaTransformer.service.js           |   6 +-
 .../generator/generator/JavaTransformer.spec.js}   |   8 +-
 .../generator}/generator/Maven.service.js          |   0
 .../generator}/generator/PlatformGenerator.js      |   0
 .../generator}/generator/Properties.service.js     |   0
 .../generator}/generator/Readme.service.js         |   0
 .../generator/SharpTransformer.service.js          |   6 +-
 .../generator/generator/SharpTransformer.spec.js}  |   6 +-
 .../generator/SpringTransformer.service.js         |   2 +-
 .../generator/generator/SpringTransformer.spec.js} |   9 +-
 .../generator}/generator/StringBuilder.js          |   0
 .../generator/defaults/Cache.platform.service.js   |   0
 .../generator}/generator/defaults/Cache.service.js |   0
 .../generator/defaults/Cluster.platform.service.js |   0
 .../generator/defaults/Cluster.service.js          |   0
 .../generator/defaults/Event-groups.service.js     |   0
 .../generator}/generator/defaults/IGFS.service.js  |   0
 .../icons/configuration.icon.svg                   |   0
 .../frontend/app/configuration/index.lazy.ts       |  48 ++
 .../page-configure => configuration}/index.ts      |  88 ++--
 .../app/{helpers/jade => configuration}/mixins.pug |  46 +-
 .../Caches.js => configuration/services/Caches.ts} |  41 +-
 .../{ => configuration}/services/Clusters.spec.js  |   0
 .../services/Clusters.ts}                          |  35 +-
 .../services/ConfigChangesGuard.spec.js            |   0
 .../services/ConfigChangesGuard.ts}                |  29 +-
 .../services/ConfigSelectionManager.ts}            |   9 +-
 .../services/ConfigurationDownload.spec.js         |   0
 .../services/ConfigurationDownload.ts}             |  32 +-
 .../services/ConfigurationResource.spec.js         |   0
 .../services/ConfigurationResource.ts}             |   9 +-
 .../services/ConfigureState.ts}                    |   3 +-
 .../IGFSs.js => configuration/services/IGFSs.ts}   |  12 +-
 .../Models.js => configuration/services/Models.ts} |  60 +--
 .../services/PageConfigure.spec.js                 |   3 +-
 .../services/PageConfigure.ts}                     |  15 +-
 .../services/SummaryZipper.ts}                     |   5 +-
 .../services/summary.worker.js                     |  16 +-
 .../states.js => configuration/states.ts}          |  14 +-
 .../store/actionCreators.js                        |   0
 .../store/actionTypes.js                           |   0
 .../store/effects.js                               |  16 +-
 .../store/effects.spec.js                          |   0
 .../store}/reducer.js                              |   2 +-
 .../store}/reducer.spec.js                         |   0
 .../store/selectors.ts}                            |  63 ++-
 .../transitionHooks/errorState.ts}                 |  15 +-
 .../frontend/app/configuration/types/index.ts      | 140 ++++++
 .../app/core/activities/Activities.data.d.ts       |  37 --
 .../{Activities.data.js => Activities.data.ts}     |  26 +-
 .../app/directives/bs-affix-update.directive.js    |  40 --
 .../app/directives/centered/centered.directive.js  |  26 --
 .../frontend/app/directives/centered/centered.scss |  37 --
 .../directives/restore-input-focus.directive.js    |  30 --
 .../ui-ace-docker/ui-ace-docker.controller.js      |  41 --
 .../ui-ace-docker/ui-ace-docker.directive.js       |  46 --
 .../app/directives/ui-ace-docker/ui-ace-docker.pug |  27 --
 .../ui-ace-pojos/ui-ace-pojos.controller.js        | 102 -----
 .../ui-ace-pojos/ui-ace-pojos.directive.js         |  46 --
 .../app/directives/ui-ace-pojos/ui-ace-pojos.pug   |  40 --
 .../directives/ui-ace-pom/ui-ace-pom.controller.js |  41 --
 .../directives/ui-ace-pom/ui-ace-pom.directive.js  |  41 --
 .../app/directives/ui-ace-pom/ui-ace-pom.pug       |  17 -
 .../ui-ace-sharp/ui-ace-sharp.controller.js        |  41 --
 .../ui-ace-sharp/ui-ace-sharp.directive.js         | 147 ------
 .../app/directives/ui-ace-sharp/ui-ace-sharp.pug   |  22 -
 .../frontend/app/helpers/jade/mixins.pug           | 384 ----------------
 .../frontend/app/services/JavaTypes.service.js     |  42 +-
 .../services/JavaTypes.spec.js}                    |  18 +-
 modules/web-console/frontend/app/services/index.js |   2 -
 .../web-console/frontend/app/store/reduxDebug.ts   |   2 +-
 .../reduxDevtoolsIntegration.js                    |   2 +-
 modules/web-console/frontend/app/types/index.ts    |   7 +
 modules/web-console/frontend/app/vendor.js         |   1 +
 modules/web-console/frontend/index.js              |   3 +-
 .../web-console/frontend/public/images/docker.png  | Bin 521 -> 0 bytes
 .../web-console/frontend/public/images/java.png    | Bin 170 -> 0 bytes
 modules/web-console/frontend/public/images/xml.png | Bin 232 -> 0 bytes
 .../frontend/public/stylesheets/style.scss         |   1 -
 modules/web-console/frontend/tsconfig.json         |   1 +
 335 files changed, 2243 insertions(+), 3272 deletions(-)

diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 9c45ce3,c53d0ec..e2f06a3
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@@ -30,8 -30,8 +30,9 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.query.QueryUtils;
  import org.apache.ignite.internal.processors.query.h2.H2Cursor;
  import org.apache.ignite.internal.processors.query.h2.H2Utils;
 +import org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModelMultiplier;
  import org.apache.ignite.internal.processors.query.h2.opt.join.CursorIteratorWrapper;
+ import org.apache.ignite.internal.processors.query.h2.opt.join.DistributedJoinContext;
  import org.apache.ignite.internal.processors.query.h2.opt.join.DistributedLookupBatch;
  import org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModel;
  import org.apache.ignite.internal.processors.query.h2.opt.join.RangeSource;
@@@ -228,14 -213,10 +214,10 @@@ public abstract class GridH2IndexBase e
          // Notice that we check for isJoinBatchEnabled, because we can do multiple different
          // optimization passes on PREPARE stage.
          // Query expressions can not be distributed as well.
-         if (qctx == null || qctx.type() != PREPARE || qctx.distributedJoinMode() == OFF ||
-             !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
-             return CollocationModelMultiplier.COLLOCATED.multiplier();
+         SplitterContext ctx = SplitterContext.get();
  
-         // We have to clear this cache because normally sub-query plan cost does not depend on anything
-         // other than index condition masks and sort order, but in our case it can depend on order
-         // of previous table filters.
-         clearViewIndexCache(ses);
+         if (!ctx.distributedJoins() || !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
 -            return CollocationModel.MULTIPLIER_COLLOCATED;
++            return CollocationModelMultiplier.COLLOCATED.multiplier();
  
          assert filters != null;
  
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index c3c2412,e5eea1d..efe413c
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@@ -771,4 -790,88 +794,17 @@@ public final class CollocationModel 
              "with custom AffinityKeyMapper configured. " +
              "Please use AffinityKeyMapped annotation instead [cache=" + cacheName + ']');
      }
+ 
+     /**
+      * @param ses Session.
+      */
+     private static void clearViewIndexCache(Session ses) {
+         // We have to clear this cache because normally sub-query plan cost does not depend on anything
+         // other than index condition masks and sort order, but in our case it can depend on order
+         // of previous table filters.
+         Map<Object,ViewIndex> viewIdxCache = ses.getViewIndexCache(true);
+ 
+         if (!viewIdxCache.isEmpty())
+             viewIdxCache.clear();
+     }
 -
 -    /**
 -     * Collocation type.
 -     */
 -    private enum Type {
 -        /** */
 -        PARTITIONED_COLLOCATED(true, true),
 -
 -        /** */
 -        PARTITIONED_NOT_COLLOCATED(true, false),
 -
 -        /** */
 -        REPLICATED(false, true);
 -
 -        /** */
 -        private final boolean partitioned;
 -
 -        /** */
 -        private final boolean collocated;
 -
 -        /**
 -         * @param partitioned Partitioned.
 -         * @param collocated Collocated.
 -         */
 -        Type(boolean partitioned, boolean collocated) {
 -            this.partitioned = partitioned;
 -            this.collocated = collocated;
 -        }
 -
 -        /**
 -         * @return {@code true} If partitioned.
 -         */
 -        public boolean isPartitioned() {
 -            return partitioned;
 -        }
 -
 -        /**
 -         * @return {@code true} If collocated.
 -         */
 -        public boolean isCollocated() {
 -            return collocated;
 -        }
 -
 -        /**
 -         * @param partitioned Partitioned.
 -         * @param collocated Collocated.
 -         * @return Type.
 -         */
 -        static Type of(boolean partitioned, boolean collocated) {
 -            if (collocated)
 -                return partitioned ? Type.PARTITIONED_COLLOCATED : Type.REPLICATED;
 -
 -            assert partitioned;
 -
 -            return Type.PARTITIONED_NOT_COLLOCATED;
 -        }
 -    }
 -
 -    /**
 -     * Affinity of a table relative to previous joined tables.
 -     */
 -    private enum Affinity {
 -        /** */
 -        NONE,
 -
 -        /** */
 -        HAS_AFFINITY_CONDITION,
 -
 -        /** */
 -        COLLOCATED_JOIN
 -    }
  }


[ignite] 02/08: Minors.

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9039d6a44de43b22c7a48a47413b75b1ae3c6725
Author: devozerov <vo...@gridgain.com>
AuthorDate: Fri Feb 1 17:40:59 2019 +0300

    Minors.
---
 .../processors/query/h2/opt/GridH2IndexBase.java     |  2 +-
 .../query/h2/opt/join/CollocationModel.java          | 20 ++++++++++----------
 .../h2/opt/join/CollocationModelMultiplier.java      |  8 ++++----
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index f353aff..9c45ce3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -230,7 +230,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
         // Query expressions can not be distributed as well.
         if (qctx == null || qctx.type() != PREPARE || qctx.distributedJoinMode() == OFF ||
             !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
-            return CollocationModelMultiplier.MULTIPLIER_COLLOCATED.multiplier();
+            return CollocationModelMultiplier.COLLOCATED.multiplier();
 
         // We have to clear this cache because normally sub-query plan cost does not depend on anything
         // other than index condition masks and sort order, but in our case it can depend on order
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index 95895fe..6b4dcb7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@ -240,14 +240,14 @@ public final class CollocationModel {
 
             boolean collocated = true;
             boolean partitioned = false;
-            CollocationModelMultiplier maxMultiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
+            CollocationModelMultiplier maxMultiplier = CollocationModelMultiplier.COLLOCATED;
 
             for (int i = 0; i < childFilters.length; i++) {
                 CollocationModel child = child(i, true);
 
                 Type t = child.type(true);
 
-                if (child.multiplier == CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
+                if (child.multiplier == CollocationModelMultiplier.REPLICATED_NOT_LAST)
                     maxMultiplier = child.multiplier;
 
                 if (t.isPartitioned()) {
@@ -261,7 +261,7 @@ public final class CollocationModel {
                         if (m.multiplier() > maxMultiplier.multiplier()) {
                             maxMultiplier = m;
 
-                            if (maxMultiplier == CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
+                            if (maxMultiplier == CollocationModelMultiplier.REPLICATED_NOT_LAST)
                                 break;
                         }
                     }
@@ -281,7 +281,7 @@ public final class CollocationModel {
             // Only partitioned tables will do distributed joins.
             if (!(tbl instanceof GridH2Table) || !((GridH2Table)tbl).isPartitioned()) {
                 type = Type.REPLICATED;
-                multiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
+                multiplier = CollocationModelMultiplier.COLLOCATED;
 
                 return;
             }
@@ -291,7 +291,7 @@ public final class CollocationModel {
             // to all the affinity nodes the "base" does not need to get remote results.
             if (!upper.findPartitionedTableBefore(filter)) {
                 type = Type.PARTITIONED_COLLOCATED;
-                multiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
+                multiplier = CollocationModelMultiplier.COLLOCATED;
             }
             else {
                 // It is enough to make sure that our previous join by affinity key is collocated, then we are
@@ -299,19 +299,19 @@ public final class CollocationModel {
                 switch (upper.joinedWithCollocated(filter)) {
                     case COLLOCATED_JOIN:
                         type = Type.PARTITIONED_COLLOCATED;
-                        multiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
+                        multiplier = CollocationModelMultiplier.COLLOCATED;
 
                         break;
 
                     case HAS_AFFINITY_CONDITION:
                         type = Type.PARTITIONED_NOT_COLLOCATED;
-                        multiplier = CollocationModelMultiplier.MULTIPLIER_UNICAST;
+                        multiplier = CollocationModelMultiplier.UNICAST;
 
                         break;
 
                     case NONE:
                         type = Type.PARTITIONED_NOT_COLLOCATED;
-                        multiplier = CollocationModelMultiplier.MULTIPLIER_BROADCAST;
+                        multiplier = CollocationModelMultiplier.BROADCAST;
 
                         break;
 
@@ -321,7 +321,7 @@ public final class CollocationModel {
             }
 
             if (upper.previousReplicated(filter))
-                multiplier = CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST;
+                multiplier = CollocationModelMultiplier.REPLICATED_NOT_LAST;
         }
     }
 
@@ -688,7 +688,7 @@ public final class CollocationModel {
 
         Type type = mdl.type(true);
 
-        if (!type.isCollocated() && mdl.multiplier == CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
+        if (!type.isCollocated() && mdl.multiplier == CollocationModelMultiplier.REPLICATED_NOT_LAST)
             throw new CacheException("Failed to execute query: for distributed join " +
                 "all REPLICATED caches must be at the end of the joined tables list.");
 
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelMultiplier.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelMultiplier.java
index d173542..74b76a3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelMultiplier.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModelMultiplier.java
@@ -22,16 +22,16 @@ package org.apache.ignite.internal.processors.query.h2.opt.join;
  */
 public enum CollocationModelMultiplier {
     /** Tables are collocated, cheap. */
-    MULTIPLIER_COLLOCATED(1),
+    COLLOCATED(1),
 
     /** */
-    MULTIPLIER_UNICAST(50),
+    UNICAST(50),
 
     /** */
-    MULTIPLIER_BROADCAST(200),
+    BROADCAST(200),
 
     /** Force REPLICATED tables to be at the end of join sequence. */
-    MULTIPLIER_REPLICATED_NOT_LAST(10_000);
+    REPLICATED_NOT_LAST(10_000);
 
     /** Multiplier value. */
     private final int multiplier;


[ignite] 07/08: Minors.

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 37ba8a68afd9d9db1a2d5915ddc0d812965eea56
Author: devozerov <vo...@gridgain.com>
AuthorDate: Mon Feb 4 11:13:03 2019 +0300

    Minors.
---
 .../internal/processors/query/h2/opt/GridH2IndexBase.java   | 13 ++++++++++---
 .../query/h2/twostep/GridReduceQueryExecutor.java           |  3 ++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 4c1757e..fa09e69 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -297,14 +297,21 @@ public abstract class GridH2IndexBase extends BaseIndex {
      * @param msg Message.
      */
     public void send(Collection<ClusterNode> nodes, Message msg) {
-        if (!getTable().rowDescriptor().indexing().send(msgTopic,
+        boolean res = getTable().rowDescriptor().indexing().send(msgTopic,
             -1,
             nodes,
             msg,
             null,
-            locNodeHnd,
+            new CIX2<ClusterNode,Message>() {
+                @Override public void applyx(ClusterNode clusterNode, Message msg) {
+                    onMessage0(clusterNode.id(), msg);
+                }
+            },
             GridIoPolicy.IDX_POOL,
-            false))
+            false
+        );
+
+        if (!res)
             throw H2Utils.retryException("Failed to send message to nodes: " + nodes);
     }
 
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 8097800..fdfb44c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -1209,7 +1209,8 @@ public class GridReduceQueryExecutor {
             specialize,
             locNodeHnd,
             GridIoPolicy.QUERY_POOL,
-            runLocParallel);
+            runLocParallel
+        );
     }
 
     /**