ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [05/12] ignite git commit: IGNITE-6406: SQL: parallel index creation. This closes #3014.
Date Wed, 29 Nov 2017 10:28:46 GMT
IGNITE-6406: SQL: parallel index creation. This closes #3014.


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

Branch: refs/heads/ignite-7016
Commit: 9a52bb28ed3a23a189a255207e85c8f6825fc683
Parents: 60cef7c
Author: rkondakov <rkondakov@gridgain.com>
Authored: Tue Nov 28 16:08:00 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Wed Nov 29 13:28:33 2017 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    |   7 +-
 .../schema/SchemaIndexCacheVisitorImpl.java     | 153 +++++++++++++++--
 .../operation/SchemaIndexCreateOperation.java   |  16 +-
 .../apache/ignite/internal/sql/SqlKeyword.java  |   3 +
 .../ignite/internal/sql/SqlParserUtils.java     |   8 +-
 .../sql/command/SqlCreateIndexCommand.java      |  95 ++++++++---
 .../sql/SqlParserCreateIndexSelfTest.java       | 152 +++++++++++------
 .../query/h2/ddl/DdlStatementsProcessor.java    |   6 +-
 .../cache/index/AbstractSchemaSelfTest.java     |   7 +-
 .../DynamicIndexAbstractBasicSelfTest.java      | 168 ++++++++++++++++---
 .../DynamicIndexAbstractConcurrentSelfTest.java |  36 ++--
 .../cache/index/SchemaExchangeSelfTest.java     |   2 +-
 12 files changed, 525 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 471888a..e52a1dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1330,7 +1330,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
                 SchemaIndexCacheFilter filter = new TableCacheFilter(cctx, op0.tableName());
 
-                SchemaIndexCacheVisitor visitor = new SchemaIndexCacheVisitorImpl(cctx, filter, cancelTok);
+                SchemaIndexCacheVisitor visitor = new SchemaIndexCacheVisitorImpl(cctx, filter, cancelTok, op0.parallel());
 
                 idx.dynamicIndexCreate(op0.schemaName(), op0.tableName(), idxDesc, op0.ifNotExists(), visitor);
             }
@@ -2174,12 +2174,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @param tblName Table name.
      * @param idx Index.
      * @param ifNotExists When set to {@code true} operation will fail if index already exists.
+     * @param parallel Index creation parallelism level.
      * @return Future completed when index is created.
      */
     public IgniteInternalFuture<?> dynamicIndexCreate(String cacheName, String schemaName, String tblName,
-        QueryIndex idx, boolean ifNotExists) {
+        QueryIndex idx, boolean ifNotExists, int parallel) {
         SchemaAbstractOperation op = new SchemaIndexCreateOperation(UUID.randomUUID(), cacheName, schemaName, tblName,
-            idx, ifNotExists);
+            idx, ifNotExists, parallel);
 
         return startIndexOperationDistributed(op);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
index c11c614..7b8de06 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
@@ -17,8 +17,8 @@
 
 package org.apache.ignite.internal.processors.query.schema;
 
-import java.util.List;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
@@ -29,8 +29,15 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalP
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
+import org.apache.ignite.internal.util.future.GridCompoundFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.GridCursor;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.util.worker.GridWorker;
+import org.apache.ignite.thread.IgniteThread;
+
+import java.util.List;
 
 import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.EVICTED;
 import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.OWNING;
@@ -41,6 +48,9 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
  */
 @SuppressWarnings("ForLoopReplaceableByForEach")
 public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
+    /** Default degree of parallelism. */
+    private static final int DFLT_PARALLELISM = Math.max(1, Runtime.getRuntime().availableProcessors() / 4);
+
     /** Count of rows, being processed within a single checkpoint lock. */
     private static final int BATCH_SIZE = 1000;
 
@@ -53,24 +63,38 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
     /** Cancellation token. */
     private final SchemaIndexOperationCancellationToken cancel;
 
+    /** Parallelism. */
+    private final int parallelism;
+
+    /** Whether to stop the process. */
+    private volatile boolean stop;
+
     /**
      * Constructor.
      *  @param cctx Cache context.
      */
     public SchemaIndexCacheVisitorImpl(GridCacheContext cctx) {
-        this(cctx, null, null);
+        this(cctx, null, null, 0);
     }
 
     /**
      * Constructor.
-     *  @param cctx Cache context.
+     *
+     * @param cctx Cache context.
+     * @param rowFilter Row filter.
      * @param cancel Cancellation token.
+     * @param parallelism Degree of parallelism.
      */
     public SchemaIndexCacheVisitorImpl(GridCacheContext cctx, SchemaIndexCacheFilter rowFilter,
-        SchemaIndexOperationCancellationToken cancel) {
+        SchemaIndexOperationCancellationToken cancel, int parallelism) {
         this.rowFilter = rowFilter;
         this.cancel = cancel;
 
+        if (parallelism > 0)
+            this.parallelism = Math.min(Runtime.getRuntime().availableProcessors(), parallelism);
+        else
+            this.parallelism =  DFLT_PARALLELISM;
+
         if (cctx.isNear())
             cctx = ((GridNearCacheAdapter)cctx.cache()).dht().context();
 
@@ -83,8 +107,63 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
 
         List<GridDhtLocalPartition> parts = cctx.topology().localPartitions();
 
-        for (int i = 0, size = parts.size(); i < size; i++)
-            processPartition(parts.get(i), clo);
+        if (parts.isEmpty())
+            return;
+
+        GridCompoundFuture<Void, Void> fut = null;
+
+        if (parallelism > 1) {
+            fut = new GridCompoundFuture<>();
+
+            for (int i = 1; i < parallelism; i++)
+                fut.add(processPartitionsAsync(parts, clo, i));
+
+            fut.markInitialized();
+        }
+
+        processPartitions(parts, clo, 0);
+
+        if (fut != null)
+            fut.get();
+    }
+
+    /**
+     * Process partitions asynchronously.
+     *
+     * @param parts Partitions.
+     * @param clo Closure.
+     * @param remainder Remainder.
+     * @return Future.
+     */
+    private GridFutureAdapter<Void> processPartitionsAsync(List<GridDhtLocalPartition> parts,
+        SchemaIndexCacheVisitorClosure clo, int remainder) {
+        GridFutureAdapter<Void> fut = new GridFutureAdapter<>();
+
+        AsyncWorker worker = new AsyncWorker(parts, clo, remainder, fut);
+
+        new IgniteThread(worker).start();
+
+        return fut;
+    }
+
+    /**
+     * Process partitions.
+     *
+     * @param parts Partitions.
+     * @param clo Closure.
+     * @param remainder Remainder.
+     * @throws IgniteCheckedException If failed.
+     */
+    private void processPartitions(List<GridDhtLocalPartition> parts, SchemaIndexCacheVisitorClosure clo,
+        int remainder)
+        throws IgniteCheckedException {
+        for (int i = 0, size = parts.size(); i < size; i++) {
+            if (stop)
+                break;
+
+            if ((i % parallelism) == remainder)
+                processPartition(parts.get(i), clo);
+        }
     }
 
     /**
@@ -107,9 +186,7 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
             return;
 
         try {
-            GridCursor<? extends CacheDataRow> cursor = part.dataStore().cursor(cctx.cacheId(),
-                null,
-                null,
+            GridCursor<? extends CacheDataRow> cursor = part.dataStore().cursor(cctx.cacheId(), null, null,
                 CacheDataRowAdapter.RowData.KEY_ONLY);
 
             boolean locked = false;
@@ -117,7 +194,7 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
             try {
                 int cntr = 0;
 
-                while (cursor.next()) {
+                while (cursor.next() && !stop) {
                     KeyCacheObject key = cursor.get().key();
 
                     if (!locked) {
@@ -194,4 +271,60 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
     @Override public String toString() {
         return S.toString(SchemaIndexCacheVisitorImpl.class, this);
     }
+
+    /**
+     * Async worker.
+     */
+    private class AsyncWorker extends GridWorker {
+        /** Partitions. */
+        private final List<GridDhtLocalPartition> parts;
+
+        /** Closure. */
+        private final SchemaIndexCacheVisitorClosure clo;
+
+        /** Remained.. */
+        private final int remainder;
+
+        /** Future. */
+        private final GridFutureAdapter<Void> fut;
+
+        /**
+         * Constructor.
+         *
+         * @param parts Partitions.
+         * @param clo Closure.
+         * @param remainder Remainder.
+         * @param fut Future.
+         */
+        @SuppressWarnings("unchecked")
+        public AsyncWorker(List<GridDhtLocalPartition> parts, SchemaIndexCacheVisitorClosure clo, int remainder,
+            GridFutureAdapter<Void> fut) {
+            super(cctx.igniteInstanceName(), "parallel-idx-worker-" + cctx.cache() + "-" + remainder,
+                cctx.logger(AsyncWorker.class));
+
+            this.parts = parts;
+            this.clo = clo;
+            this.remainder = remainder;
+            this.fut = fut;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException {
+            Throwable err = null;
+
+            try {
+                processPartitions(parts, clo, remainder);
+            }
+            catch (Throwable e) {
+                err = e;
+
+                U.error(log, "Error during parallel index create/rebuild.", e);
+
+                stop = true;
+            }
+            finally {
+                fut.onDone(err);
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexCreateOperation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexCreateOperation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexCreateOperation.java
index 7b4543f..c2e891c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexCreateOperation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexCreateOperation.java
@@ -41,6 +41,9 @@ public class SchemaIndexCreateOperation extends SchemaIndexAbstractOperation {
     /** Ignore operation if index exists. */
     private final boolean ifNotExists;
 
+    /** Index creation parallelism level */
+    private final int parallel;
+
     /**
      * Constructor.
      *
@@ -50,14 +53,16 @@ public class SchemaIndexCreateOperation extends SchemaIndexAbstractOperation {
      * @param tblName Table name.
      * @param idx Index params.
      * @param ifNotExists Ignore operation if index exists.
+     * @param parallel Index creation parallelism level.
      */
     public SchemaIndexCreateOperation(UUID opId, String cacheName, String schemaName, String tblName, QueryIndex idx,
-        boolean ifNotExists) {
+        boolean ifNotExists, int parallel) {
         super(opId, cacheName, schemaName);
 
         this.tblName = tblName;
         this.idx = idx;
         this.ifNotExists = ifNotExists;
+        this.parallel = parallel;
     }
 
     /** {@inheritDoc} */
@@ -86,6 +91,15 @@ public class SchemaIndexCreateOperation extends SchemaIndexAbstractOperation {
         return ifNotExists;
     }
 
+    /**
+     * Gets index creation parallelism level.
+     *
+     * @return Index creation parallelism level.
+     */
+    public int parallel() {
+        return parallel;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(SchemaIndexCreateOperation.class, this, "parent", super.toString());

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java b/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java
index 08fa94b..021dfb9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java
@@ -201,6 +201,9 @@ public class SqlKeyword {
     /** Keyword: YEAR. */
     public static final String YEAR = "YEAR";
 
+    /** Keyword: PARALLEL. */
+    public static final String PARALLEL = "PARALLEL";
+
     /** All keywords. */
     private static final HashSet<String> KEYWORDS;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParserUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParserUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParserUtils.java
index d812b3d..829c48c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParserUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParserUtils.java
@@ -71,7 +71,7 @@ public class SqlParserUtils {
     }
 
     /**
-     * Skip commr or right parenthesis.
+     * Skip comma or right parenthesis.
      *
      * @param lex Lexer.
      * @return {@code True} if right parenthesis is found.
@@ -130,7 +130,7 @@ public class SqlParserUtils {
      * @return Name.
      */
     public static String parseIdentifier(SqlLexer lex, String... additionalExpTokens) {
-        if (lex.shift() && isVaildIdentifier(lex))
+        if (lex.shift() && isValidIdentifier(lex))
             return lex.token();
 
         throw errorUnexpectedToken(lex, "[identifier]", additionalExpTokens);
@@ -144,7 +144,7 @@ public class SqlParserUtils {
      * @return Qualified name.
      */
     public static SqlQualifiedName parseQualifiedIdentifier(SqlLexer lex, String... additionalExpTokens) {
-        if (lex.shift() && isVaildIdentifier(lex)) {
+        if (lex.shift() && isValidIdentifier(lex)) {
             SqlQualifiedName res = new SqlQualifiedName();
 
             String first = lex.token();
@@ -171,7 +171,7 @@ public class SqlParserUtils {
      * @param token Token.
      * @return {@code True} if we are standing on possible identifier.
      */
-    public static boolean isVaildIdentifier(SqlLexerToken token) {
+    public static boolean isValidIdentifier(SqlLexerToken token) {
         switch (token.tokenType()) {
             case DEFAULT:
                 char c = token.tokenFirstChar();

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlCreateIndexCommand.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlCreateIndexCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlCreateIndexCommand.java
index 05eeb44..f3f38d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlCreateIndexCommand.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlCreateIndexCommand.java
@@ -38,11 +38,13 @@ import static org.apache.ignite.internal.sql.SqlKeyword.DESC;
 import static org.apache.ignite.internal.sql.SqlKeyword.IF;
 import static org.apache.ignite.internal.sql.SqlKeyword.INLINE_SIZE;
 import static org.apache.ignite.internal.sql.SqlKeyword.ON;
+import static org.apache.ignite.internal.sql.SqlKeyword.PARALLEL;
 import static org.apache.ignite.internal.sql.SqlParserUtils.error;
 import static org.apache.ignite.internal.sql.SqlParserUtils.errorUnexpectedToken;
 import static org.apache.ignite.internal.sql.SqlParserUtils.matchesKeyword;
 import static org.apache.ignite.internal.sql.SqlParserUtils.parseIdentifier;
 import static org.apache.ignite.internal.sql.SqlParserUtils.parseIfNotExists;
+import static org.apache.ignite.internal.sql.SqlParserUtils.parseInt;
 import static org.apache.ignite.internal.sql.SqlParserUtils.parseQualifiedIdentifier;
 import static org.apache.ignite.internal.sql.SqlParserUtils.skipCommaOrRightParenthesis;
 import static org.apache.ignite.internal.sql.SqlParserUtils.skipIfMatchesKeyword;
@@ -66,6 +68,12 @@ public class SqlCreateIndexCommand implements SqlCommand {
     /** Spatial index flag. */
     private boolean spatial;
 
+    /**
+     * Parallelism level. <code>parallel=0</code> means that a default number
+     * of cores will be used during index creation (e.g. 25% of available cores).
+     */
+    private int parallel;
+
     /** Columns. */
     @GridToStringInclude
     private Collection<SqlIndexColumn> cols;
@@ -109,6 +117,13 @@ public class SqlCreateIndexCommand implements SqlCommand {
     }
 
     /**
+     * @return Parallelism level.
+     */
+    public int parallel() {
+        return parallel;
+    }
+
+    /**
      * @return Spatial index flag.
      */
     public boolean spatial() {
@@ -154,7 +169,7 @@ public class SqlCreateIndexCommand implements SqlCommand {
 
         parseColumnList(lex);
 
-        parseInlineSize(lex);
+        parseIndexProperties(lex);
 
         return this;
     }
@@ -172,25 +187,6 @@ public class SqlCreateIndexCommand implements SqlCommand {
         return parseIdentifier(lex, IF);
     }
 
-    /**
-     * Parses inline size option if exists.
-     *
-     * @param lex Lexer.
-     */
-    private void parseInlineSize(SqlLexer lex) {
-        SqlLexerToken nextTok = lex.lookAhead();
-
-        if (matchesKeyword(nextTok, INLINE_SIZE)) {
-            lex.shift();
-
-            int stmtInlineSize = SqlParserUtils.parseInt(lex);
-
-            if (stmtInlineSize < 0)
-                throw error(lex, "Inline size should be positive: " + stmtInlineSize);
-
-            inlineSize = stmtInlineSize;
-        }
-    }
 
     /**
      * @param lex Lexer.
@@ -242,6 +238,65 @@ public class SqlCreateIndexCommand implements SqlCommand {
         cols.add(col);
     }
 
+    /**
+     * Parses CREATE INDEX command properties.
+     *
+     * @param lex Lexer.
+     */
+    private void parseIndexProperties(SqlLexer lex) {
+        Set<String> foundProps = new HashSet<>();
+
+        while (true) {
+            SqlLexerToken token = lex.lookAhead();
+
+            if (token.tokenType() == SqlLexerTokenType.EOF)
+                return;
+
+            if (token.tokenType() == SqlLexerTokenType.DEFAULT) {
+                switch (token.token()) {
+                    case PARALLEL:
+                        parallel = getIntProperty(lex, PARALLEL, foundProps);
+
+                        if (parallel < 0)
+                            throw error(lex, "Illegal " + PARALLEL + " value. Should be positive: " + parallel);
+
+                        break;
+
+                    case INLINE_SIZE:
+                        inlineSize = getIntProperty(lex, INLINE_SIZE, foundProps);
+
+                        if (inlineSize < 0)
+                            throw error(lex, "Illegal " + INLINE_SIZE +
+                                " value. Should be positive: " + inlineSize);
+
+                        break;
+
+                    default:
+                        return;
+                }
+            }
+        }
+
+    }
+
+    /**
+     * Parses <code>Integer</code> property by its keyword.
+     * @param lex Lexer.
+     * @param keyword Keyword.
+     * @param foundProps Set of properties to check if one has already been found in SQL clause.
+     * @return parsed value;
+     */
+    private Integer getIntProperty(SqlLexer lex, String keyword, Set<String> foundProps) {
+        if (foundProps.contains(keyword))
+            throw error(lex, "Only one " + keyword + " clause may be specified.");
+
+        foundProps.add(keyword);
+
+        lex.shift();
+
+        return parseInt(lex);
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(SqlCreateIndexCommand.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserCreateIndexSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserCreateIndexSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserCreateIndexSelfTest.java
index 8cfeb2c..80328ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserCreateIndexSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserCreateIndexSelfTest.java
@@ -17,18 +17,27 @@
 
 package org.apache.ignite.internal.sql;
 
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.internal.sql.command.SqlCreateIndexCommand;
 import org.apache.ignite.internal.sql.command.SqlIndexColumn;
 import org.apache.ignite.internal.util.typedef.F;
 
-import java.util.Collection;
-import java.util.Iterator;
+import static org.apache.ignite.internal.sql.SqlKeyword.INLINE_SIZE;
+import static org.apache.ignite.internal.sql.SqlKeyword.PARALLEL;
 
 /**
  * Tests for SQL parser: CREATE INDEX.
  */
 @SuppressWarnings({"UnusedReturnValue", "ThrowableNotThrown"})
 public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
+    /** Default properties */
+    private static final Map<String, Object> DEFAULT_PROPS = getProps(null, null);
+
     /**
      * Tests for CREATE INDEX command.
      *
@@ -36,44 +45,44 @@ public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
      */
     public void testCreateIndex() throws Exception {
         // Base.
-        parseValidate(null, "CREATE INDEX idx ON tbl(a)", null, "TBL", "IDX", "A", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a ASC)", null, "TBL", "IDX", "A", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC)", null, "TBL", "IDX", "A", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a ASC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", true);
 
         // Case (in)sensitivity.
-        parseValidate(null, "CREATE INDEX IDX ON TBL(COL)", null, "TBL", "IDX", "COL", false);
-        parseValidate(null, "CREATE INDEX iDx ON tBl(cOl)", null, "TBL", "IDX", "COL", false);
+        parseValidate(null, "CREATE INDEX IDX ON TBL(COL)", null, "TBL", "IDX", DEFAULT_PROPS, "COL", false);
+        parseValidate(null, "CREATE INDEX iDx ON tBl(cOl)", null, "TBL", "IDX", DEFAULT_PROPS, "COL", false);
 
-        parseValidate(null, "CREATE INDEX \"idx\" ON tbl(col)", null, "TBL", "idx", "COL", false);
-        parseValidate(null, "CREATE INDEX \"iDx\" ON tbl(col)", null, "TBL", "iDx", "COL", false);
+        parseValidate(null, "CREATE INDEX \"idx\" ON tbl(col)", null, "TBL", "idx", DEFAULT_PROPS, "COL", false);
+        parseValidate(null, "CREATE INDEX \"iDx\" ON tbl(col)", null, "TBL", "iDx", DEFAULT_PROPS, "COL", false);
 
-        parseValidate(null, "CREATE INDEX idx ON \"tbl\"(col)", null, "tbl", "IDX", "COL", false);
-        parseValidate(null, "CREATE INDEX idx ON \"tBl\"(col)", null, "tBl", "IDX", "COL", false);
+        parseValidate(null, "CREATE INDEX idx ON \"tbl\"(col)", null, "tbl", "IDX", DEFAULT_PROPS, "COL", false);
+        parseValidate(null, "CREATE INDEX idx ON \"tBl\"(col)", null, "tBl", "IDX", DEFAULT_PROPS, "COL", false);
 
-        parseValidate(null, "CREATE INDEX idx ON tbl(\"col\")", null, "TBL", "IDX", "col", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(\"cOl\")", null, "TBL", "IDX", "cOl", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(\"col\")", null, "TBL", "IDX", DEFAULT_PROPS, "col", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(\"cOl\")", null, "TBL", "IDX", DEFAULT_PROPS, "cOl", false);
 
-        parseValidate(null, "CREATE INDEX idx ON tbl(\"cOl\" ASC)", null, "TBL", "IDX", "cOl", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(\"cOl\" DESC)", null, "TBL", "IDX", "cOl", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(\"cOl\" ASC)", null, "TBL", "IDX", DEFAULT_PROPS, "cOl", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(\"cOl\" DESC)", null, "TBL", "IDX", DEFAULT_PROPS, "cOl", true);
 
         // Columns.
-        parseValidate(null, "CREATE INDEX idx ON tbl(a, b)", null, "TBL", "IDX", "A", false, "B", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a, b)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", false);
 
-        parseValidate(null, "CREATE INDEX idx ON tbl(a ASC, b)", null, "TBL", "IDX", "A", false, "B", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a, b ASC)", null, "TBL", "IDX", "A", false, "B", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a ASC, b ASC)", null, "TBL", "IDX", "A", false, "B", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a ASC, b)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a, b ASC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a ASC, b ASC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", false);
 
-        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC, b)", null, "TBL", "IDX", "A", true, "B", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a, b DESC)", null, "TBL", "IDX", "A", false, "B", true);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC, b DESC)", null, "TBL", "IDX", "A", true, "B", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC, b)", null, "TBL", "IDX", DEFAULT_PROPS, "A", true, "B", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a, b DESC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC, b DESC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", true, "B", true);
 
-        parseValidate(null, "CREATE INDEX idx ON tbl(a ASC, b DESC)", null, "TBL", "IDX", "A", false, "B", true);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC, b ASC)", null, "TBL", "IDX", "A", true, "B", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a ASC, b DESC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC, b ASC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", true, "B", false);
 
-        parseValidate(null, "CREATE INDEX idx ON tbl(a, b, c)", null, "TBL", "IDX", "A", false, "B", false, "C", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC, b, c)", null, "TBL", "IDX", "A", true, "B", false, "C", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a, b DESC, c)", null, "TBL", "IDX", "A", false, "B", true, "C", false);
-        parseValidate(null, "CREATE INDEX idx ON tbl(a, b, c DESC)", null, "TBL", "IDX", "A", false, "B", false, "C", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a, b, c)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", false, "C", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC, b, c)", null, "TBL", "IDX", DEFAULT_PROPS, "A", true, "B", false, "C", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a, b DESC, c)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", true, "C", false);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a, b, c DESC)", null, "TBL", "IDX", DEFAULT_PROPS, "A", false, "B", false, "C", true);
 
         // Negative cases.
         assertParseError(null, "CREATE INDEX idx ON tbl()", "Unexpected token");
@@ -82,25 +91,25 @@ public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
         assertParseError(null, "CREATE INDEX idx ON tbl(b, a, a)", "Column already defined: A");
 
         // Tests with schema.
-        parseValidate(null, "CREATE INDEX idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", "A", false);
-        parseValidate(null, "CREATE INDEX idx ON \"schema\".tbl(a)", "schema", "TBL", "IDX", "A", false);
-        parseValidate(null, "CREATE INDEX idx ON \"sChema\".tbl(a)", "sChema", "TBL", "IDX", "A", false);
+        parseValidate(null, "CREATE INDEX idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", DEFAULT_PROPS, "A", false);
+        parseValidate(null, "CREATE INDEX idx ON \"schema\".tbl(a)", "schema", "TBL", "IDX", DEFAULT_PROPS, "A", false);
+        parseValidate(null, "CREATE INDEX idx ON \"sChema\".tbl(a)", "sChema", "TBL", "IDX", DEFAULT_PROPS, "A", false);
 
-        parseValidate("SCHEMA", "CREATE INDEX idx ON tbl(a)", "SCHEMA", "TBL", "IDX", "A", false);
-        parseValidate("schema", "CREATE INDEX idx ON tbl(a)", "schema", "TBL", "IDX", "A", false);
-        parseValidate("sChema", "CREATE INDEX idx ON tbl(a)", "sChema", "TBL", "IDX", "A", false);
+        parseValidate("SCHEMA", "CREATE INDEX idx ON tbl(a)", "SCHEMA", "TBL", "IDX", DEFAULT_PROPS, "A", false);
+        parseValidate("schema", "CREATE INDEX idx ON tbl(a)", "schema", "TBL", "IDX", DEFAULT_PROPS, "A", false);
+        parseValidate("sChema", "CREATE INDEX idx ON tbl(a)", "sChema", "TBL", "IDX", DEFAULT_PROPS, "A", false);
 
         // No index name.
-        parseValidate(null, "CREATE INDEX ON tbl(a)", null, "TBL", null, "A", false);
-        parseValidate(null, "CREATE INDEX ON schema.tbl(a)", "SCHEMA", "TBL", null, "A", false);
+        parseValidate(null, "CREATE INDEX ON tbl(a)", null, "TBL", null, DEFAULT_PROPS, "A", false);
+        parseValidate(null, "CREATE INDEX ON schema.tbl(a)", "SCHEMA", "TBL", null, DEFAULT_PROPS, "A", false);
 
         // NOT EXISTS
         SqlCreateIndexCommand cmd;
 
-        cmd = parseValidate(null, "CREATE INDEX idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", "A", false);
+        cmd = parseValidate(null, "CREATE INDEX idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", DEFAULT_PROPS, "A", false);
         assertFalse(cmd.ifNotExists());
 
-        cmd = parseValidate(null, "CREATE INDEX IF NOT EXISTS idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", "A", false);
+        cmd = parseValidate(null, "CREATE INDEX IF NOT EXISTS idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", DEFAULT_PROPS, "A", false);
         assertTrue(cmd.ifNotExists());
 
         assertParseError(null, "CREATE INDEX IF idx ON tbl(a)", "Unexpected token: \"IDX\"");
@@ -109,10 +118,10 @@ public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
         assertParseError(null, "CREATE INDEX NOT EXISTS idx ON tbl(a)", "Unexpected token: \"NOT\"");
 
         // SPATIAL
-        cmd = parseValidate(null, "CREATE INDEX idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", "A", false);
+        cmd = parseValidate(null, "CREATE INDEX idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", DEFAULT_PROPS, "A", false);
         assertFalse(cmd.spatial());
 
-        cmd = parseValidate(null, "CREATE SPATIAL INDEX idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", "A", false);
+        cmd = parseValidate(null, "CREATE SPATIAL INDEX idx ON schema.tbl(a)", "SCHEMA", "TBL", "IDX", DEFAULT_PROPS, "A", false);
         assertTrue(cmd.spatial());
 
         // UNIQUE
@@ -124,6 +133,15 @@ public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
         // PRIMARY KEY
         assertParseError(null, "CREATE PRIMARY KEY INDEX idx ON tbl(a)", "Unsupported keyword: \"PRIMARY\"");
 
+        // PARALLEL
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC) PARALLEL 1", null, "TBL", "IDX", getProps(1, null), "A", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC) PARALLEL  3", null, "TBL", "IDX", getProps(3, null), "A", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC)   PARALLEL  7", null, "TBL", "IDX", getProps(7, null), "A", true);
+        parseValidate(null, "CREATE INDEX idx ON tbl(a DESC)   PARALLEL  0", null, "TBL", "IDX", getProps(0, null), "A", true);
+        assertParseError(null, "CREATE INDEX idx ON tbl(a DESC) PARALLEL ", "Failed to parse SQL statement \"CREATE INDEX idx ON tbl(a DESC) PARALLEL [*]\"");
+        assertParseError(null, "CREATE INDEX idx ON tbl(a DESC) PARALLEL abc", "Unexpected token: \"ABC\"");
+        assertParseError(null, "CREATE INDEX idx ON tbl(a DESC) PARALLEL -2", "Failed to parse SQL statement \"CREATE INDEX idx ON tbl(a DESC) PARALLEL -[*]2\": Illegal PARALLEL value. Should be positive: -2");
+
         // INLINE_SIZE option
         assertParseError(null, "CREATE INDEX ON tbl(a) INLINE_SIZE",
             "Unexpected end of command (expected: \"[integer]\")");
@@ -138,14 +156,24 @@ public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
             "Unexpected token: \"9223372036854775808\" (expected: \"[integer]\")");
 
         assertParseError(null, "CREATE INDEX ON tbl(a) INLINE_SIZE " + Integer.MIN_VALUE,
-            "Inline size should be positive: " + Integer.MIN_VALUE);
+            "Illegal INLINE_SIZE value. Should be positive: " + Integer.MIN_VALUE);
 
-        assertParseError(null, "CREATE INDEX ON tbl(a) INLINE_SIZE -1", "Inline size should be positive: -1");
+        assertParseError(null, "CREATE INDEX ON tbl(a) INLINE_SIZE -1", "Failed to parse SQL statement \"CREATE INDEX ON tbl(a) INLINE_SIZE -[*]1\": Illegal INLINE_SIZE value. Should be positive: -1");
 
-        parseValidate(null, "CREATE INDEX idx ON schema.tbl(a) INLINE_SIZE 0", "SCHEMA", "TBL", "IDX", "A", false);
-        parseValidate(null, "CREATE INDEX idx ON schema.tbl(a) INLINE_SIZE 1", "SCHEMA", "TBL", "IDX", "A", false);
+        parseValidate(null, "CREATE INDEX idx ON schema.tbl(a) INLINE_SIZE 0", "SCHEMA", "TBL", "IDX", getProps(null, 0), "A", false);
+        parseValidate(null, "CREATE INDEX idx ON schema.tbl(a) INLINE_SIZE 1", "SCHEMA", "TBL", "IDX", getProps(null, 1), "A", false);
         parseValidate(null, "CREATE INDEX idx ON schema.tbl(a) INLINE_SIZE " + Integer.MAX_VALUE,
-            "SCHEMA", "TBL", "IDX", "A", false);
+            "SCHEMA", "TBL", "IDX", getProps(null, Integer.MAX_VALUE), "A", false);
+
+        // Both parallel and inline size
+        parseValidate(null, "CREATE INDEX idx ON schema.tbl(a) INLINE_SIZE 5 PARALLEL 7", "SCHEMA", "TBL", "IDX", getProps(7, 5), "A", false);
+        parseValidate(null, "CREATE INDEX idx ON schema.tbl(a) PARALLEL 3 INLINE_SIZE 9 ", "SCHEMA", "TBL", "IDX", getProps(3, 9), "A", false);
+
+        assertParseError(null, "CREATE INDEX idx ON schema.tbl(a) PARALLEL 3 INLINE_SIZE 9 PARALLEL 2", "Failed to parse SQL statement \"CREATE INDEX idx ON schema.tbl(a) PARALLEL 3 INLINE_SIZE [*]9 PARALLEL 2\": Only one PARALLEL clause may be specified.");
+        assertParseError(null, "CREATE INDEX idx ON schema.tbl(a) PARALLEL 3 INLINE_SIZE 9 abc ", "Failed to parse SQL statement \"CREATE INDEX idx ON schema.tbl(a) PARALLEL 3 INLINE_SIZE 9 [*]abc \": Unexpected token: \"ABC\"");
+        assertParseError(null, "CREATE INDEX idx ON schema.tbl(a) PARALLEL  INLINE_SIZE 9 abc ", "Failed to parse SQL statement \"CREATE INDEX idx ON schema.tbl(a) PARALLEL  [*]INLINE_SIZE 9 abc \": Unexpected token: \"INLINE_SIZE\" (expected: \"[integer]\")");
+        assertParseError(null, "CREATE INDEX idx ON schema.tbl(a) PARALLEL 3 INLINE_SIZE abc ", "Failed to parse SQL statement \"CREATE INDEX idx ON schema.tbl(a) PARALLEL 3 INLINE_SIZE [*]abc \": Unexpected token: \"ABC\" (expected: \"[integer]\")");
+
     }
 
     /**
@@ -156,14 +184,15 @@ public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
      * @param expSchemaName Expected schema name.
      * @param expTblName Expected table name.
      * @param expIdxName Expected index name.
+     * @param props Expected properties.
      * @param expColDefs Expected column definitions.
      * @return Command.
      */
     private static SqlCreateIndexCommand parseValidate(String schema, String sql, String expSchemaName,
-        String expTblName, String expIdxName, Object... expColDefs) {
+        String expTblName, String expIdxName, Map<String, Object> props, Object... expColDefs) {
         SqlCreateIndexCommand cmd = (SqlCreateIndexCommand)new SqlParser(schema, sql).nextCommand();
 
-        validate(cmd, expSchemaName, expTblName, expIdxName, expColDefs);
+        validate(cmd, expSchemaName, expTblName, expIdxName, props, expColDefs);
 
         return cmd;
     }
@@ -175,14 +204,19 @@ public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
      * @param expSchemaName Expected schema name.
      * @param expTblName Expected table name.
      * @param expIdxName Expected index name.
+     * @param props Expected properties.
      * @param expColDefs Expected column definitions.
      */
     private static void validate(SqlCreateIndexCommand cmd, String expSchemaName, String expTblName, String expIdxName,
-        Object... expColDefs) {
+        Map<String, Object> props, Object... expColDefs) {
         assertEquals(expSchemaName, cmd.schemaName());
         assertEquals(expTblName, cmd.tableName());
         assertEquals(expIdxName, cmd.indexName());
 
+        Map<String, Object> cmpProps = getProps(cmd.parallel(), cmd.inlineSize());
+
+        assertEquals(cmpProps, props);
+
         if (F.isEmpty(expColDefs) || expColDefs.length % 2 == 1)
             throw new IllegalArgumentException("Column definitions must be even.");
 
@@ -202,4 +236,26 @@ public class SqlParserCreateIndexSelfTest extends SqlParserAbstractSelfTest {
             assertEquals(expDesc, (Boolean)col.descending());
         }
     }
+
+    /**
+     * Returns map with command properties.
+     *
+     * @param parallel Parallel property value. <code>Null</code> for a default value.
+     * @param inlineSize Inline size property value. <code>Null</code> for a default value.
+     * @return Command properties.
+     */
+    private static Map<String, Object> getProps(Integer parallel, Integer inlineSize) {
+        if (parallel == null)
+            parallel = 0;
+
+        if (inlineSize == null)
+            inlineSize = QueryIndex.DFLT_INLINE_SIZE;
+
+        Map<String, Object> props = new HashMap<>();
+
+        props.put(PARALLEL, parallel);
+        props.put(INLINE_SIZE, inlineSize);
+
+        return Collections.unmodifiableMap(props);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index ea721f7..68aab49 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -137,8 +137,8 @@ public class DdlStatementsProcessor {
                 newIdx.setFields(flds);
                 newIdx.setInlineSize(cmd0.inlineSize());
 
-                fut = ctx.query().dynamicIndexCreate(tbl.cacheName(), cmd0.schemaName(), typeDesc.tableName(),
-                    newIdx, cmd0.ifNotExists());
+                fut = ctx.query().dynamicIndexCreate(tbl.cacheName(), cmd.schemaName(), typeDesc.tableName(),
+                    newIdx, cmd0.ifNotExists(), cmd0.parallel());
             }
             else if (cmd instanceof SqlDropIndexCommand) {
                 SqlDropIndexCommand cmd0 = (SqlDropIndexCommand)cmd;
@@ -231,7 +231,7 @@ public class DdlStatementsProcessor {
                 newIdx.setFields(flds);
 
                 fut = ctx.query().dynamicIndexCreate(tbl.cacheName(), cmd.schemaName(), typeDesc.tableName(),
-                    newIdx, cmd.ifNotExists());
+                    newIdx, cmd.ifNotExists(), 0);
             }
             else if (stmt0 instanceof GridSqlDropIndex) {
                 GridSqlDropIndex cmd = (GridSqlDropIndex) stmt0;

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
index 0074020..01d1f36 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
@@ -467,9 +467,11 @@ public class AbstractSchemaSelfTest extends GridCommonAbstractTest {
      * @param tblName Table name.
      * @param idx Index.
      * @param ifNotExists When set to true operation will fail if index already exists.
+     * @param parallel Parallelism level.
      * @throws Exception If failed.
      */
-    protected void dynamicIndexCreate(Ignite node, String cacheName, String tblName, QueryIndex idx, boolean ifNotExists)
+    protected void dynamicIndexCreate(Ignite node, String cacheName, String tblName, QueryIndex idx,
+        boolean ifNotExists, int parallel)
         throws Exception {
         GridStringBuilder sql = new SB("CREATE INDEX ")
             .a(ifNotExists ? "IF NOT EXISTS " : "")
@@ -497,6 +499,9 @@ public class AbstractSchemaSelfTest extends GridCommonAbstractTest {
         if (idx.getInlineSize() != QueryIndex.DFLT_INLINE_SIZE)
             sql.a(" INLINE_SIZE ").a(idx.getInlineSize());
 
+        if (parallel != 0)
+            sql.a(" PARALLEL ").a(parallel);
+
         executeSql(node, cacheName, sql.toString());
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
index f7d99b4..bf469f1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
@@ -197,16 +197,16 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
         final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
 
-        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1_ESCAPED));
 
         assertSchemaException(new RunnableX() {
             @Override public void run() throws Exception {
-                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
             }
         }, IgniteQueryErrorCode.INDEX_ALREADY_EXISTS);
 
-        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
+        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true, 0);
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1_ESCAPED));
 
         assertSimpleIndexOperations(SQL_SIMPLE_FIELD_1);
@@ -281,7 +281,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
         final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED), field(alias(FIELD_NAME_2_ESCAPED)));
 
-        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE,
             field(FIELD_NAME_1_ESCAPED), field(alias(FIELD_NAME_2_ESCAPED)));
 
@@ -360,7 +360,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
         try {
             String cacheName = randomString();
 
-            queryProcessor(node()).dynamicIndexCreate(cacheName, cacheName, TBL_NAME, idx, false).get();
+            queryProcessor(node()).dynamicIndexCreate(cacheName, cacheName, TBL_NAME, idx, false, 0).get();
         }
         catch (SchemaOperationException e) {
             assertEquals(SchemaOperationException.CODE_CACHE_NOT_FOUND, e.code());
@@ -445,7 +445,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
         assertSchemaException(new RunnableX() {
             @Override public void run() throws Exception {
-                dynamicIndexCreate(CACHE_NAME, randomString(), idx, false);
+                dynamicIndexCreate(CACHE_NAME, randomString(), idx, false, 0);
             }
         }, IgniteQueryErrorCode.TABLE_NOT_FOUND);
 
@@ -521,7 +521,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
         assertSchemaException(new RunnableX() {
             @Override public void run() throws Exception {
-                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
             }
         }, IgniteQueryErrorCode.COLUMN_NOT_FOUND);
 
@@ -598,7 +598,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
             @Override public void run() throws Exception {
                 QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_2_ESCAPED));
 
-                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
             }
         }, IgniteQueryErrorCode.COLUMN_NOT_FOUND);
 
@@ -606,7 +606,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
         QueryIndex idx = index(IDX_NAME_1, field(alias(FIELD_NAME_2_ESCAPED)));
 
-        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(alias(FIELD_NAME_2_ESCAPED)));
 
         assertSimpleIndexOperations(SQL_SIMPLE_FIELD_2);
@@ -713,7 +713,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
         QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
         idx.setInlineSize(inlineSize);
 
-        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
 
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, inlineSize, field(FIELD_NAME_1_ESCAPED));
         assertSimpleIndexOperations(SQL_SIMPLE_FIELD_1);
@@ -736,7 +736,137 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
             @Override public void run() throws Exception {
                 QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
                 idx.setInlineSize(inlineSize);
-                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
+            }
+        }, igniteQryErrorCode);
+
+        assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
+    }
+
+
+    /**
+     * Tests creating index with parallelism for PARTITIONED ATOMIC cache.
+     *
+     * @throws Exception If failed.
+     */
+    public void testCreateIndexWithParallelismPartitionedAtomic() throws Exception {
+        checkCreateIndexWithParallelism(PARTITIONED, ATOMIC, false);
+    }
+
+    /**
+     * Tests creating index with parallelism for PARTITIONED ATOMIC cache with near cache.
+     *
+     * @throws Exception If failed.
+     */
+    public void testCreateIndexWithParallelismPartitionedAtomicNear() throws Exception {
+        checkCreateIndexWithParallelism(PARTITIONED, ATOMIC, true);
+    }
+
+    /**
+     * Tests creating index with parallelism for PARTITIONED TRANSACTIONAL cache.
+     *
+     * @throws Exception If failed.
+     */
+    public void testCreateIndexWithParallelismPartitionedTransactional() throws Exception {
+        checkCreateIndexWithParallelism(PARTITIONED, TRANSACTIONAL, false);
+    }
+
+    /**
+     * Tests creating index with parallelism for PARTITIONED TRANSACTIONAL cache with near cache.
+     *
+     * @throws Exception If failed.
+     */
+    public void testCreateIndexWithParallelismPartitionedTransactionalNear() throws Exception {
+        checkCreateIndexWithParallelism(PARTITIONED, TRANSACTIONAL, true);
+    }
+
+    /**
+     * Tests creating index with parallelism for REPLICATED ATOMIC cache.
+     *
+     * @throws Exception If failed.
+     */
+    public void testCreateIndexWithParallelismReplicatedAtomic() throws Exception {
+        checkCreateIndexWithParallelism(REPLICATED, ATOMIC, false);
+    }
+
+    /**
+     * Tests creating index with parallelism option for REPLICATED TRANSACTIONAL cache.
+     *
+     * @throws Exception If failed.
+     */
+    public void testCreateIndexWithParallelismReplicatedTransactional() throws Exception {
+        checkCreateIndexWithParallelism(REPLICATED, TRANSACTIONAL, false);
+    }
+
+    /**
+     * Checks that parallelism parameter is correctly handled during index creation.
+     *
+     * @param mode Mode.
+     * @param atomicityMode Atomicity mode.
+     * @param near Near flag.
+     * @throws Exception If failed.
+     */
+    private void checkCreateIndexWithParallelism(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near)
+        throws Exception {
+
+        initialize(mode, atomicityMode, near);
+
+        String prevFallbackPropVal = System.getProperty(IgniteSystemProperties.IGNITE_SQL_PARSER_DISABLE_H2_FALLBACK);
+
+        try {
+            System.setProperty(IgniteSystemProperties.IGNITE_SQL_PARSER_DISABLE_H2_FALLBACK, "true");
+
+            checkNoIndexIsCreatedForParallelism(-2, IgniteQueryErrorCode.PARSING);
+            checkNoIndexIsCreatedForParallelism(Integer.MIN_VALUE, IgniteQueryErrorCode.PARSING);
+
+            checkIndexCreatedForParallelism(0);
+            loadInitialData();
+            checkIndexCreatedForParallelism(1);
+            loadInitialData();
+            checkIndexCreatedForParallelism(5);
+        }
+        finally {
+            if (prevFallbackPropVal != null)
+                System.setProperty(IgniteSystemProperties.IGNITE_SQL_PARSER_DISABLE_H2_FALLBACK, prevFallbackPropVal);
+            else
+                System.clearProperty(IgniteSystemProperties.IGNITE_SQL_PARSER_DISABLE_H2_FALLBACK);
+        }
+    }
+
+    /**
+     * Verifies that index was created properly with different parallelism levels.
+     * NOTE! Unfortunately we cannot check the real parallelism level on which this index was created because it should
+     * use internal API. But we can check if this index was created properly on different parallelism levels.
+     *
+     * @param parallel Parallelism level to put into CREATE INDEX
+     * @throws Exception If failed.
+     */
+    private void checkIndexCreatedForParallelism(int parallel) throws Exception {
+        QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
+
+        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, parallel);
+
+        assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1_ESCAPED));
+        assertSimpleIndexOperations(SQL_SIMPLE_FIELD_1);
+        assertIndexUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_1, SQL_ARG_1);
+
+        dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, false);
+
+        assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
+    }
+
+    /**
+     * Verifies that no index is created and an exception is thrown.
+     *
+     * @param parallel Parallelism level in the CREATE INDEX statement.
+     * @param igniteQryErrorCode Expected error code in the thrown exception.
+     * @throws Exception If failed for any other reason than the expected exception.
+     */
+    private void checkNoIndexIsCreatedForParallelism(final int parallel, int igniteQryErrorCode) throws Exception {
+        assertSchemaException(new RunnableX() {
+            @Override public void run() throws Exception {
+                QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
+                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, parallel);
             }
         }, igniteQryErrorCode);
 
@@ -811,7 +941,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
         // Create target index.
         QueryIndex idx1 = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
 
-        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx1, false);
+        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx1, false, 0);
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1_ESCAPED));
 
         assertIndexUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_1, SQL_ARG_1);
@@ -821,7 +951,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
         // Create another index which must stay intact afterwards.
         QueryIndex idx2 = index(IDX_NAME_2, field(alias(FIELD_NAME_2_ESCAPED)));
 
-        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx2, false);
+        dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx2, false, 0);
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_2, QueryIndex.DFLT_INLINE_SIZE, field(alias(FIELD_NAME_2_ESCAPED)));
 
         // Load some data.
@@ -1015,7 +1145,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
         assertSchemaException(new RunnableX() {
             @Override public void run() throws Exception {
-                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
+                dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true, 0);
             }
         }, IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
 
@@ -1036,7 +1166,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
     public void testNonSqlCache() throws Exception {
         final QueryIndex idx = index(IDX_NAME_2, field(FIELD_NAME_1));
 
-        dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true);
+        dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true, 0);
         assertIndex(STATIC_CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1_ESCAPED));
 
         dynamicIndexDrop(STATIC_CACHE_NAME, IDX_NAME_1, true);
@@ -1087,7 +1217,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
         final QueryIndex idx = index(idxNameToCreate, field(FIELD_NAME_1));
 
-        dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true);
+        dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true, 0);
 
         dynamicIndexDrop(STATIC_CACHE_NAME, checkedIdxName, false);
     }
@@ -1102,7 +1232,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
         final QueryIndex idx = index(idxNameToCreate, field(FIELD_NAME_1));
 
-        dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true);
+        dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true, 0);
 
         GridTestUtils.assertThrows(null, new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -1288,9 +1418,9 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
      * @param ifNotExists When set to true operation will fail if index already exists.
      * @throws Exception If failed.
      */
-    private void dynamicIndexCreate(String cacheName, String tblName, QueryIndex idx, boolean ifNotExists)
+    private void dynamicIndexCreate(String cacheName, String tblName, QueryIndex idx, boolean ifNotExists, int parallel)
         throws Exception {
-        dynamicIndexCreate(node(), cacheName, tblName, idx, ifNotExists);
+        dynamicIndexCreate(node(), cacheName, tblName, idx, ifNotExists, parallel);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
index 610688a..65ceb24 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
@@ -159,7 +159,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         QueryIndex idx1 = index(IDX_NAME_1, field(FIELD_NAME_1));
 
         IgniteInternalFuture<?> idxFut1 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME,
-            idx1, false);
+            idx1, false, 0);
 
         idxLatch.countDown();
 
@@ -180,7 +180,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         QueryIndex idx2 = index(IDX_NAME_2, field(aliasUnescaped(FIELD_NAME_2)));
 
         IgniteInternalFuture<?> idxFut2 =
-            queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false);
+            queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false, 0);
 
         idxLatch.countDown();
 
@@ -216,10 +216,10 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         QueryIndex idx2 = index(IDX_NAME_2, field(aliasUnescaped(FIELD_NAME_2)));
 
         IgniteInternalFuture<?> idxFut1 =
-            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx1, false);
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx1, false, 0);
 
         IgniteInternalFuture<?> idxFut2 =
-            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false);
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false, 0);
 
         // Start even more nodes of different flavors
         ignitionStart(serverConfiguration(5));
@@ -263,7 +263,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
         IgniteInternalFuture<?> idxFut =
-            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0);
 
         ignitionStart(serverConfiguration(2));
         ignitionStart(serverConfiguration(3, true));
@@ -333,7 +333,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         // Create index.
         QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
-        queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
+        queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0).get();
 
         // Stop updates once index is ready.
         stopped.set(true);
@@ -405,7 +405,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
         final IgniteInternalFuture<?> idxFut =
-            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0);
 
         idxLatch1.countDown();
         idxLatch2.countDown();
@@ -454,7 +454,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
         final IgniteInternalFuture<?> idxFut =
-            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0);
 
         idxLatch.countDown();
 
@@ -509,7 +509,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
                         exists = false;
                     }
                     else {
-                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true);
+                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true, 0);
 
                         exists = true;
                     }
@@ -537,7 +537,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         idxFut.get();
 
         queryProcessor(cli).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, true).get();
-        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true).get();
+        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true, 0).get();
 
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1));
 
@@ -585,7 +585,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
                         exists = false;
                     }
                     else {
-                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true);
+                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true, 0);
 
                         exists = true;
                     }
@@ -666,7 +666,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
             @Override public void run() throws Exception {
                 final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
-                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
+                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0).get();
             }
         });
 
@@ -688,7 +688,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         // Update existing index.
         QueryIndex idx = index(IDX_NAME_2, field(aliasUnescaped(FIELD_NAME_2)));
 
-        queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
+        queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0).get();
 
         assertIndex(cli, true, CACHE_NAME, TBL_NAME, IDX_NAME_2, QueryIndex.DFLT_INLINE_SIZE,
             field(aliasUnescaped(FIELD_NAME_2)));
@@ -701,7 +701,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
 
                 final QueryIndex idx = index(IDX_NAME_2, field(FIELD_NAME_1), field(aliasUnescaped(FIELD_NAME_2)));
 
-                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
+                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0).get();
             }
         });
 
@@ -830,7 +830,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
                         exists = false;
                     }
                     else {
-                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true);
+                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true, 0);
 
                         exists = true;
                     }
@@ -862,7 +862,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         createSqlCache(cli);
 
         queryProcessor(cli).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, true).get();
-        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true).get();
+        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true, 0).get();
 
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1));
 
@@ -931,7 +931,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
                         exists = false;
                     }
                     else {
-                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true);
+                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true, 0);
 
                         exists = true;
                     }
@@ -963,7 +963,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         createSqlCache(cli);
 
         queryProcessor(cli).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, true).get();
-        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true).get();
+        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true, 0).get();
 
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9a52bb28/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java
index 1d0e973..b92c792 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java
@@ -470,7 +470,7 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
                 final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
 
                 try {
-                    dynamicIndexCreate(node1, CACHE_NAME, TBL_NAME, idx, false);
+                    dynamicIndexCreate(node1, CACHE_NAME, TBL_NAME, idx, false, 0);
                 }
                 catch (Exception e) {
                     throw new IgniteException(e);


Mime
View raw message