ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-5264: Improved schema-based handling for CREATE INDEX and DROP INDEX operations. This closes #1990.
Date Tue, 23 May 2017 11:22:37 GMT
Repository: ignite
Updated Branches:
  refs/heads/master c5a04da71 -> 3ef78264a


IGNITE-5264: Improved schema-based handling for CREATE INDEX and DROP INDEX operations. This closes #1990.


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

Branch: refs/heads/master
Commit: 3ef78264a36171d064627741d8e340c236bc7d38
Parents: c5a04da
Author: devozerov <vozerov@gridgain.com>
Authored: Tue May 23 14:22:29 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Tue May 23 14:22:29 2017 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    | 91 +++++++++++---------
 .../processors/query/schema/SchemaKey.java      | 59 -------------
 .../message/SchemaProposeDiscoveryMessage.java  |  7 +-
 .../operation/SchemaAbstractOperation.java      | 25 ++++--
 .../operation/SchemaIndexAbstractOperation.java |  7 +-
 .../operation/SchemaIndexCreateOperation.java   |  8 +-
 .../operation/SchemaIndexDropOperation.java     |  7 +-
 .../processors/query/h2/IgniteH2Indexing.java   | 31 ++++++-
 .../query/h2/database/H2PkHashIndex.java        |  2 +-
 .../query/h2/database/H2TreeIndex.java          |  2 +-
 .../query/h2/ddl/DdlStatementsProcessor.java    | 21 +++--
 .../query/h2/opt/GridH2CollocationModel.java    |  6 +-
 .../query/h2/opt/GridH2IndexBase.java           |  2 +-
 .../processors/query/h2/opt/GridH2Table.java    | 48 ++++++++---
 .../query/h2/opt/GridH2TreeIndex.java           |  2 +-
 .../query/h2/sql/GridSqlDropIndex.java          | 14 +--
 .../query/h2/sql/GridSqlQueryParser.java        |  2 +-
 .../DynamicIndexAbstractBasicSelfTest.java      |  8 +-
 .../DynamicIndexAbstractConcurrentSelfTest.java | 66 +++++++-------
 .../cache/index/SchemaExchangeSelfTest.java     |  2 +-
 .../query/h2/sql/GridQueryParsingTest.java      |  4 +-
 21 files changed, 222 insertions(+), 192 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/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 13525f6..1731edc 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
@@ -52,7 +52,6 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
 import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorImpl;
 import org.apache.ignite.internal.processors.query.schema.SchemaIndexOperationCancellationToken;
-import org.apache.ignite.internal.processors.query.schema.SchemaKey;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationClientFuture;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationManager;
@@ -155,7 +154,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     private final GridMessageListener ioLsnr;
 
     /** Schema operations. */
-    private final ConcurrentHashMap<SchemaKey, SchemaOperation> schemaOps = new ConcurrentHashMap<>();
+    private final ConcurrentHashMap<String, SchemaOperation> schemaOps = new ConcurrentHashMap<>();
 
     /** Active propose messages. */
     private final LinkedHashMap<UUID, SchemaProposeDiscoveryMessage> activeProposals = new LinkedHashMap<>();
@@ -339,19 +338,21 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @return {@code True} if exchange should be triggered.
      */
     private boolean onSchemaProposeDiscovery(SchemaProposeDiscoveryMessage msg) {
-        UUID opId = msg.operation().id();
-        String space = msg.operation().space();
+        SchemaAbstractOperation op = msg.operation();
+
+        UUID opId = op.id();
+        String cacheName = op.cacheName();
 
         if (!msg.initialized()) {
             // Ensure cache exists on coordinator node.
-            DynamicCacheDescriptor cacheDesc = ctx.cache().cacheDescriptor(space);
+            DynamicCacheDescriptor cacheDesc = ctx.cache().cacheDescriptor(cacheName);
 
             if (cacheDesc == null) {
                 if (log.isDebugEnabled())
                     log.debug("Received schema propose discovery message, but cache doesn't exist " +
                         "(will report error) [opId=" + opId + ", msg=" + msg + ']');
 
-                msg.onError(new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, space));
+                msg.onError(new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, cacheName));
             }
             else {
                 CacheConfiguration ccfg = cacheDesc.cacheConfiguration();
@@ -417,9 +418,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             // running operation.
             SchemaOperation schemaOp = new SchemaOperation(msg);
 
-            SchemaKey key = msg.schemaKey();
+            String schemaName = msg.schemaName();
 
-            SchemaOperation prevSchemaOp = schemaOps.get(key);
+            SchemaOperation prevSchemaOp = schemaOps.get(schemaName);
 
             if (prevSchemaOp != null) {
                 prevSchemaOp = prevSchemaOp.unwind();
@@ -433,7 +434,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 return false;
             }
             else {
-                schemaOps.put(key, schemaOp);
+                schemaOps.put(schemaName, schemaOp);
 
                 return exchangeReady;
             }
@@ -456,7 +457,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             if (disconnected)
                 return;
 
-            SchemaOperation curOp = schemaOps.get(msg.schemaKey());
+            SchemaOperation curOp = schemaOps.get(msg.schemaName());
 
             assert curOp != null;
             assert F.eq(opId, curOp.id());
@@ -493,7 +494,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
             // Apply changes to public cache schema if operation is successful and original cache is still there.
             if (!msg.hasError()) {
-                DynamicCacheDescriptor cacheDesc = ctx.cache().cacheDescriptor(msg.operation().space());
+                DynamicCacheDescriptor cacheDesc = ctx.cache().cacheDescriptor(msg.operation().cacheName());
 
                 if (cacheDesc != null && F.eq(cacheDesc.deploymentId(), proposeMsg.deploymentId()))
                     cacheDesc.schemaChangeFinish(msg);
@@ -503,7 +504,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             msg.proposeMessage(proposeMsg);
 
             if (exchangeReady) {
-                SchemaOperation op = schemaOps.get(proposeMsg.schemaKey());
+                SchemaOperation op = schemaOps.get(proposeMsg.schemaName());
 
                 if (F.eq(op.id(), opId)) {
                     // Completed top operation.
@@ -529,9 +530,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             }
             else {
                 // Set next operation as top-level one.
-                SchemaKey schemaKey = proposeMsg.schemaKey();
+                String schemaName = proposeMsg.schemaName();
 
-                SchemaOperation op = schemaOps.remove(schemaKey);
+                SchemaOperation op = schemaOps.remove(schemaName);
 
                 assert op != null;
                 assert F.eq(op.id(), opId);
@@ -540,7 +541,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 SchemaOperation nextOp = op.next();
 
                 if (nextOp != null)
-                    schemaOps.put(schemaKey, nextOp);
+                    schemaOps.put(schemaName, nextOp);
             }
 
             // Clean stale IO messages from just-joined nodes.
@@ -571,13 +572,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         // Get current cache state.
         SchemaProposeDiscoveryMessage msg = schemaOp.proposeMessage();
 
-        String space = msg.operation().space();
+        String cacheName = msg.operation().cacheName();
 
-        DynamicCacheDescriptor cacheDesc = ctx.cache().cacheDescriptor(space);
+        DynamicCacheDescriptor cacheDesc = ctx.cache().cacheDescriptor(cacheName);
 
         boolean cacheExists = cacheDesc != null && F.eq(msg.deploymentId(), cacheDesc.deploymentId());
 
-        boolean cacheRegistered = cacheExists && spaces.contains(CU.mask(space));
+        boolean cacheRegistered = cacheExists && spaces.contains(CU.mask(cacheName));
 
         // Validate schema state and decide whether we should proceed or not.
         SchemaAbstractOperation op = msg.operation();
@@ -612,7 +613,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             }
         }
         else
-            err = new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, op.space());
+            err = new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, cacheName);
 
         // Start operation.
         SchemaOperationWorker worker =
@@ -897,7 +898,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         boolean nop = false;
         SchemaOperationException err = null;
 
-        String space = op.space();
+        String cacheName = op.cacheName();
 
         if (op instanceof SchemaIndexCreateOperation) {
             SchemaIndexCreateOperation op0 = (SchemaIndexCreateOperation) op;
@@ -907,7 +908,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             // Make sure table exists.
             String tblName = op0.tableName();
 
-            type = type(space, tblName);
+            type = type(cacheName, tblName);
 
             if (type == null)
                 err = new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND, tblName);
@@ -927,7 +928,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             if (err == null) {
                 String idxName = op0.index().getName();
 
-                QueryIndexKey idxKey = new QueryIndexKey(space, idxName);
+                QueryIndexKey idxKey = new QueryIndexKey(cacheName, idxName);
 
                 if (idxs.get(idxKey) != null) {
                     if (op0.ifNotExists())
@@ -942,7 +943,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
             String idxName = op0.indexName();
 
-            QueryIndexDescriptorImpl oldIdx = idxs.get(new QueryIndexKey(space, idxName));
+            QueryIndexDescriptorImpl oldIdx = idxs.get(new QueryIndexKey(cacheName, idxName));
 
             if (oldIdx == null) {
                 if (op0.ifExists())
@@ -1153,6 +1154,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             if (log.isDebugEnabled())
                 log.debug("Local operation finished successfully [opId=" + op.id() + ']');
 
+            String cacheName = op.cacheName();
+
             try {
                 if (op instanceof SchemaIndexCreateOperation) {
                     SchemaIndexCreateOperation op0 = (SchemaIndexCreateOperation)op;
@@ -1161,7 +1164,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
                     QueryIndexDescriptorImpl idxDesc = type.index(op0.indexName());
 
-                    QueryIndexKey idxKey = new QueryIndexKey(op.space(), op0.indexName());
+                    QueryIndexKey idxKey = new QueryIndexKey(cacheName, op0.indexName());
 
                     idxs.put(idxKey, idxDesc);
                 }
@@ -1172,7 +1175,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
                     QueryUtils.processDynamicIndexChange(op0.indexName(), null, type);
 
-                    QueryIndexKey idxKey = new QueryIndexKey(op.space(), op0.indexName());
+                    QueryIndexKey idxKey = new QueryIndexKey(cacheName, op0.indexName());
 
                     idxs.remove(idxKey);
                 }
@@ -1227,12 +1230,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         if (log.isDebugEnabled())
             log.debug("Started local index operation [opId=" + op.id() + ']');
 
-        String space = op.space();
+        String cacheName = op.cacheName();
 
-        GridCacheAdapter cache = ctx.cache().internalCache(op.space());
+        GridCacheAdapter cache = ctx.cache().internalCache(cacheName);
 
         if (cache == null || !F.eq(depId, cache.context().dynamicDeploymentId()))
-            throw new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, op.space());
+            throw new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, cacheName);
 
         try {
             if (op instanceof SchemaIndexCreateOperation) {
@@ -1241,14 +1244,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 QueryIndexDescriptorImpl idxDesc = QueryUtils.createIndexDescriptor(type, op0.index());
 
                 SchemaIndexCacheVisitor visitor =
-                    new SchemaIndexCacheVisitorImpl(this, cache.context(), space, op0.tableName(), cancelTok);
+                    new SchemaIndexCacheVisitorImpl(this, cache.context(), cacheName, op0.tableName(), cancelTok);
 
-                idx.dynamicIndexCreate(space, op0.tableName(), idxDesc, op0.ifNotExists(), visitor);
+                idx.dynamicIndexCreate(cacheName, op0.tableName(), idxDesc, op0.ifNotExists(), visitor);
             }
             else if (op instanceof SchemaIndexDropOperation) {
                 SchemaIndexDropOperation op0 = (SchemaIndexDropOperation) op;
 
-                idx.dynamicIndexDrop(space, op0.indexName(), op0.ifExists());
+                idx.dynamicIndexDrop(cacheName, op0.indexName(), op0.ifExists());
             }
             else
                 throw new SchemaOperationException("Unsupported operation: " + op);
@@ -1861,15 +1864,17 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     /**
      * Entry point for index procedure.
      *
-     * @param space Space name.
+     * @param cacheName Cache name.
+     * @param schemaName Schema name.
      * @param tblName Table name.
      * @param idx Index.
      * @param ifNotExists When set to {@code true} operation will fail if index already exists.
      * @return Future completed when index is created.
      */
-    public IgniteInternalFuture<?> dynamicIndexCreate(String space, String tblName, QueryIndex idx,
-        boolean ifNotExists) {
-        SchemaAbstractOperation op = new SchemaIndexCreateOperation(UUID.randomUUID(), space, tblName, idx, ifNotExists);
+    public IgniteInternalFuture<?> dynamicIndexCreate(String cacheName, String schemaName, String tblName,
+        QueryIndex idx, boolean ifNotExists) {
+        SchemaAbstractOperation op = new SchemaIndexCreateOperation(UUID.randomUUID(), cacheName, schemaName, tblName,
+            idx, ifNotExists);
 
         return startIndexOperationDistributed(op);
     }
@@ -1877,12 +1882,16 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     /**
      * Entry point for index drop procedure
      *
+     * @param cacheName Cache name.
+     * @param schemaName Schema name.
      * @param idxName Index name.
      * @param ifExists When set to {@code true} operation fill fail if index doesn't exists.
      * @return Future completed when index is created.
      */
-    public IgniteInternalFuture<?> dynamicIndexDrop(String space, String idxName, boolean ifExists) {
-        SchemaAbstractOperation op = new SchemaIndexDropOperation(UUID.randomUUID(), space, idxName, ifExists);
+    public IgniteInternalFuture<?> dynamicIndexDrop(String cacheName, String schemaName, String idxName,
+        boolean ifExists) {
+        SchemaAbstractOperation op = new SchemaIndexDropOperation(UUID.randomUUID(), cacheName, schemaName, idxName,
+            ifExists);
 
         return startIndexOperationDistributed(op);
     }
@@ -2215,7 +2224,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             SchemaProposeDiscoveryMessage proposeMsg = activeProposals.get(opId);
 
             if (proposeMsg != null) {
-                SchemaOperation op = schemaOps.get(proposeMsg.schemaKey());
+                SchemaOperation op = schemaOps.get(proposeMsg.schemaName());
 
                 if (op != null && F.eq(op.id(), opId) && op.started() && coordinator().isLocal()) {
                     if (log.isDebugEnabled())
@@ -2401,14 +2410,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 return;
 
             final UUID opId = id();
-            final SchemaKey key = proposeMsg.schemaKey();
+            final String schemaName = proposeMsg.schemaName();
 
             // Operation might be still in progress on client nodes which are not tracked by coordinator,
             // so we chain to operation future instead of doing synchronous unwind.
             mgr.worker().future().listen(new IgniteInClosure<IgniteInternalFuture>() {
                 @Override public void apply(IgniteInternalFuture fut) {
                     synchronized (stateMux) {
-                        SchemaOperation op = schemaOps.remove(key);
+                        SchemaOperation op = schemaOps.remove(schemaName);
 
                         assert op != null;
                         assert F.eq(op.id(), opId);
@@ -2417,7 +2426,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                         final SchemaOperation nextOp = op.next();
 
                         if (nextOp != null) {
-                            schemaOps.put(key, nextOp);
+                            schemaOps.put(schemaName, nextOp);
 
                             if (log.isDebugEnabled())
                                 log.debug("Next schema change operation started [opId=" + nextOp.id() + ']');

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaKey.java
deleted file mode 100644
index 3f12b77..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaKey.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.schema;
-
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.lang.IgniteUuid;
-
-/**
- * Schema key.
- */
-public class SchemaKey {
-    /** Space. */
-    private final String space;
-
-    /** Deployment ID. */
-    private final IgniteUuid depId;
-
-    /**
-     * Constructor.
-     *
-     * @param space Space.
-     * @param depId Deployment ID.
-     */
-    public SchemaKey(String space, IgniteUuid depId) {
-        this.space = space;
-        this.depId = depId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        return 31 * (space != null ? space.hashCode() : 0) + depId.hashCode();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        if (obj instanceof SchemaKey) {
-            SchemaKey other = (SchemaKey)obj;
-
-            return F.eq(space, other.space) && F.eq(depId, other.depId);
-        }
-
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/message/SchemaProposeDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/message/SchemaProposeDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/message/SchemaProposeDiscoveryMessage.java
index 664ee03..5fd2606 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/message/SchemaProposeDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/message/SchemaProposeDiscoveryMessage.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.query.schema.message;
 
 import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
-import org.apache.ignite.internal.processors.query.schema.SchemaKey;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
 import org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractOperation;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -120,10 +119,10 @@ public class SchemaProposeDiscoveryMessage extends SchemaAbstractDiscoveryMessag
     }
 
     /**
-     * @return Schema key.
+     * @return Schema name.
      */
-    public SchemaKey schemaKey() {
-        return new SchemaKey(operation().space(), depId);
+    public String schemaName() {
+        return operation().schemaName();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaAbstractOperation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaAbstractOperation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaAbstractOperation.java
index 8418ece..726c90c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaAbstractOperation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaAbstractOperation.java
@@ -32,18 +32,22 @@ public abstract class SchemaAbstractOperation implements Serializable {
     /** Operation ID. */
     private final UUID opId;
 
-    /** Space. */
-    private final String space;
+    /** Cache name. */
+    private final String cacheName;
+
+    /** Schema name. */
+    private final String schemaName;
 
     /**
      * Constructor.
      *
      * @param opId Operation ID.
-     * @param space Space.
+     * @param schemaName Schema name.
      */
-    public SchemaAbstractOperation(UUID opId, String space) {
+    public SchemaAbstractOperation(UUID opId, String cacheName, String schemaName) {
         this.opId = opId;
-        this.space = space;
+        this.cacheName = cacheName;
+        this.schemaName = schemaName;
     }
 
     /**
@@ -56,8 +60,15 @@ public abstract class SchemaAbstractOperation implements Serializable {
     /**
      * @return Space.
      */
-    public String space() {
-        return space;
+    public String cacheName() {
+        return cacheName;
+    }
+
+    /**
+     * @return Schema name.
+     */
+    public String schemaName() {
+        return schemaName;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexAbstractOperation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexAbstractOperation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexAbstractOperation.java
index fc4a9ff..31badd0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexAbstractOperation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexAbstractOperation.java
@@ -27,10 +27,11 @@ public abstract class SchemaIndexAbstractOperation extends SchemaAbstractOperati
      * Constructor.
      *
      * @param opId Operation ID.
-     * @param space Space.
+     * @param cacheName Cache name.
+     * @param schemaName Schema name.
      */
-    public SchemaIndexAbstractOperation(UUID opId, String space) {
-        super(opId, space);
+    public SchemaIndexAbstractOperation(UUID opId, String cacheName, String schemaName) {
+        super(opId, cacheName, schemaName);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/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 9281f2a..7b4543f 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
@@ -45,13 +45,15 @@ public class SchemaIndexCreateOperation extends SchemaIndexAbstractOperation {
      * Constructor.
      *
      * @param opId Operation id.
-     * @param space Space.
+     * @param cacheName Cache name.
+     * @param schemaName Schame name.
      * @param tblName Table name.
      * @param idx Index params.
      * @param ifNotExists Ignore operation if index exists.
      */
-    public SchemaIndexCreateOperation(UUID opId, String space, String tblName, QueryIndex idx, boolean ifNotExists) {
-        super(opId, space);
+    public SchemaIndexCreateOperation(UUID opId, String cacheName, String schemaName, String tblName, QueryIndex idx,
+        boolean ifNotExists) {
+        super(opId, cacheName, schemaName);
 
         this.tblName = tblName;
         this.idx = idx;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexDropOperation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexDropOperation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexDropOperation.java
index da60560..406be66 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexDropOperation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/operation/SchemaIndexDropOperation.java
@@ -38,12 +38,13 @@ public class SchemaIndexDropOperation extends SchemaIndexAbstractOperation {
      * Constructor.
      *
      * @param opId Operation id.
-     * @param space Space.
+     * @param cacheName Cache name.
+     * @param schemaName Schema name.
      * @param idxName Index name.
      * @param ifExists Ignore operation if index doesn't exist.
      */
-    public SchemaIndexDropOperation(UUID opId, String space, String idxName, boolean ifExists) {
-        super(opId, space);
+    public SchemaIndexDropOperation(UUID opId, String cacheName, String schemaName, String idxName, boolean ifExists) {
+        super(opId, cacheName, schemaName);
 
         this.idxName = idxName;
         this.ifExists = ifExists;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 0874ddc..ce69bb1 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1616,7 +1616,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                             break;
                         }
                         catch (SQLException e) {
-                            if (!cachesCreated && e.getErrorCode() == ErrorCode.SCHEMA_NOT_FOUND_1) {
+                            if (!cachesCreated && (
+                                e.getErrorCode() == ErrorCode.SCHEMA_NOT_FOUND_1 ||
+                                e.getErrorCode() == ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1 ||
+                                e.getErrorCode() == ErrorCode.INDEX_NOT_FOUND_1)
+                            ) {
                                 try {
                                     ctx.cache().createMissingQueryCaches();
                                 }
@@ -1632,7 +1636,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                         }
                     }
 
-
                     prepared = GridSqlQueryParser.prepared(stmt);
 
                     if (qry instanceof JdbcSqlFieldsQuery && ((JdbcSqlFieldsQuery) qry).isQuery() != prepared.isQuery())
@@ -1642,8 +1645,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                     if (prepared.isQuery()) {
                         bindParameters(stmt, F.asList(qry.getArgs()));
 
-                        twoStepQry = GridSqlQuerySplitter.split((JdbcPreparedStatement)stmt, qry.getArgs(), grpByCollocated,
-                            distributedJoins, enforceJoinOrder, this);
+                        twoStepQry = GridSqlQuerySplitter.split((JdbcPreparedStatement)stmt, qry.getArgs(),
+                            grpByCollocated, distributedJoins, enforceJoinOrder, this);
 
                         assert twoStepQry != null;
                     }
@@ -2035,6 +2038,26 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /**
+     * Find table for index.
+     *
+     * @param schemaName Schema name.
+     * @param idxName Index name.
+     * @return Table or {@code null} if index is not found.
+     */
+    public GridH2Table dataTableForIndex(String schemaName, String idxName) {
+        for (Map.Entry<QueryTable, GridH2Table> dataTableEntry : dataTables.entrySet()) {
+            if (F.eq(dataTableEntry.getKey().schema(), schemaName)) {
+                GridH2Table h2Tbl = dataTableEntry.getValue();
+
+                if (h2Tbl.containsUserIndex(idxName))
+                    return h2Tbl;
+            }
+        }
+
+        return null;
+    }
+
+    /**
      * Gets corresponding DB type from java class.
      *
      * @param cls Java class.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
index 149eda7..7579fa5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
@@ -90,7 +90,7 @@ public class H2PkHashIndex extends GridH2IndexBase {
         IgniteBiPredicate<Object, Object> p = null;
 
         if (f != null) {
-            String spaceName = getTable().spaceName();
+            String spaceName = getTable().cacheName();
 
             p = f.forSpace(spaceName);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index 58ab32d..814df77 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -167,7 +167,7 @@ public class H2TreeIndex extends GridH2IndexBase {
             IgniteBiPredicate<Object, Object> p = null;
 
             if (f != null) {
-                String spaceName = getTable().spaceName();
+                String spaceName = getTable().cacheName();
 
                 p = f.forSpace(spaceName);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/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 949ea6a..fe2bfdb 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
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlDropIndex;
 import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser;
 import org.apache.ignite.internal.processors.query.h2.sql.GridSqlStatement;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.h2.command.Prepared;
 import org.h2.command.ddl.CreateIndex;
 import org.h2.command.ddl.DropIndex;
@@ -87,8 +88,6 @@ public class DdlStatementsProcessor {
             if (gridStmt instanceof GridSqlCreateIndex) {
                 GridSqlCreateIndex createIdx = (GridSqlCreateIndex)gridStmt;
 
-                String spaceName = idx.space(createIdx.schemaName());
-
                 QueryIndex newIdx = new QueryIndex();
 
                 newIdx.setName(createIdx.index().getName());
@@ -119,14 +118,24 @@ public class DdlStatementsProcessor {
 
                 newIdx.setFields(flds);
 
-                fut = ctx.query().dynamicIndexCreate(spaceName, typeDesc.tableName(), newIdx, createIdx.ifNotExists());
+                fut = ctx.query().dynamicIndexCreate(tbl.cacheName(), createIdx.schemaName(), typeDesc.tableName(),
+                    newIdx, createIdx.ifNotExists());
             }
             else if (gridStmt instanceof GridSqlDropIndex) {
                 GridSqlDropIndex dropIdx = (GridSqlDropIndex)gridStmt;
 
-                String spaceName = idx.space(dropIdx.schemaName());
-
-                fut = ctx.query().dynamicIndexDrop(spaceName, dropIdx.name(), dropIdx.ifExists());
+                GridH2Table tbl = idx.dataTableForIndex(dropIdx.schemaName(), dropIdx.indexName());
+
+                if (tbl != null)
+                    fut = ctx.query().dynamicIndexDrop(tbl.cacheName(), dropIdx.schemaName(), dropIdx.indexName(),
+                        dropIdx.ifExists());
+                else {
+                    if (dropIdx.ifExists())
+                        fut = new GridFinishedFuture();
+                    else
+                        throw new SchemaOperationException(SchemaOperationException.CODE_INDEX_NOT_FOUND,
+                            dropIdx.indexName());
+                }
             }
             else
                 throw new IgniteSQLException("Unsupported DDL operation: " + sql,

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java
index 037607b..5cb983c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java
@@ -387,11 +387,11 @@ public final class GridH2CollocationModel {
 
         if (validate) {
             if (tbl.rowDescriptor().context().customAffinityMapper())
-                throw customAffinityError(tbl.spaceName());
+                throw customAffinityError(tbl.cacheName());
 
             if (F.isEmpty(tf.getIndexConditions())) {
                 throw new CacheException("Failed to prepare distributed join query: " +
-                    "join condition does not use index [joinedCache=" + tbl.spaceName() +
+                    "join condition does not use index [joinedCache=" + tbl.cacheName() +
                     ", plan=" + tf.getSelect().getPlanSQL() + ']');
             }
         }
@@ -484,7 +484,7 @@ public final class GridH2CollocationModel {
 
         if (t instanceof GridH2Table) {
             if (validate && ((GridH2Table)t).rowDescriptor().context().customAffinityMapper())
-                throw customAffinityError(((GridH2Table)t).spaceName());
+                throw customAffinityError(((GridH2Table)t).cacheName());
 
             IndexColumn affCol = ((GridH2Table)t).getAffinityKeyColumn();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
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 12850f4..30fb612 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
@@ -342,7 +342,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
      * @return Filtered iterator.
      */
     protected GridCursor<GridH2Row> filter(GridCursor<GridH2Row> cursor, IndexingQueryFilter filter) {
-        return new FilteringCursor(cursor, U.currentTimeMillis(), filter, getTable().spaceName());
+        return new FilteringCursor(cursor, U.currentTimeMillis(), filter, getTable().cacheName());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index 37c03e3..41cf68b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -65,7 +65,7 @@ import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType
  */
 public class GridH2Table extends TableBase {
     /** */
-    private final String spaceName;
+    private final String cacheName;
 
     /** */
     private final GridH2RowDescriptor desc;
@@ -116,16 +116,16 @@ public class GridH2Table extends TableBase {
      * @param desc Row descriptor.
      * @param rowFactory Row factory.
      * @param idxsFactory Indexes factory.
-     * @param spaceName Space name.
+     * @param cacheName Cache name.
      */
     public GridH2Table(CreateTableData createTblData, @Nullable GridH2RowDescriptor desc, H2RowFactory rowFactory,
-        GridH2SystemIndexFactory idxsFactory, @Nullable String spaceName) {
+        GridH2SystemIndexFactory idxsFactory, String cacheName) {
         super(createTblData);
 
         assert idxsFactory != null;
 
         this.desc = desc;
-        this.spaceName = spaceName;
+        this.cacheName = cacheName;
 
         if (desc != null && desc.context() != null && !desc.context().customAffinityMapper()) {
             boolean affinityColExists = true;
@@ -211,8 +211,8 @@ public class GridH2Table extends TableBase {
     /**
      * @return Space name.
      */
-    @Nullable public String spaceName() {
-        return spaceName;
+    @Nullable public String cacheName() {
+        return cacheName;
     }
 
     /** {@inheritDoc} */
@@ -759,12 +759,12 @@ public class GridH2Table extends TableBase {
 
             Index cloneIdx = createDuplicateIndexIfNeeded(idx);
 
-            ArrayList<Index> newIdxs = new ArrayList<>(
-                    idxs.size() + ((cloneIdx == null) ? 1 : 2));
+            ArrayList<Index> newIdxs = new ArrayList<>(idxs.size() + ((cloneIdx == null) ? 1 : 2));
 
             newIdxs.addAll(idxs);
 
             newIdxs.add(idx);
+
             if (cloneIdx != null)
                 newIdxs.add(cloneIdx);
 
@@ -804,6 +804,23 @@ public class GridH2Table extends TableBase {
         }
     }
 
+    /**
+     * Check whether user index with provided name exists.
+     *
+     * @param idxName Index name.
+     * @return {@code True} if exists.
+     */
+    public boolean containsUserIndex(String idxName) {
+        for (int i = 2; i < idxs.size(); i++) {
+            Index idx = idxs.get(i);
+
+            if (idx.getName().equalsIgnoreCase(idxName))
+                return true;
+        }
+
+        return false;
+    }
+
     /** {@inheritDoc} */
     @Override public void removeIndex(Index h2Idx) {
         throw DbException.getUnsupportedException("must use removeIndex(session, idx)");
@@ -823,7 +840,7 @@ public class GridH2Table extends TableBase {
             Index targetIdx = (h2Idx instanceof GridH2ProxyIndex)?
                     ((GridH2ProxyIndex)h2Idx).underlyingIndex(): h2Idx;
 
-            for (int i = 2; i < idxs.size(); ) {
+            for (int i = 2; i < idxs.size();) {
                 Index idx = idxs.get(i);
 
                 if (idx == targetIdx || (idx instanceof GridH2ProxyIndex &&
@@ -983,24 +1000,29 @@ public class GridH2Table extends TableBase {
      * @return Proxy index.
      */
     public Index createDuplicateIndexIfNeeded(Index target) {
-        if (!(target instanceof H2TreeIndex) &&
-            !(target instanceof SpatialIndex))
+        if (!(target instanceof H2TreeIndex) && !(target instanceof SpatialIndex))
             return null;
 
         IndexColumn[] cols = target.getIndexColumns();
+
         List<IndexColumn> proxyCols = new ArrayList<>(cols.length);
+
         boolean modified = false;
-        for (int i = 0; i < cols.length; i++) {
-            IndexColumn col = cols[i];
+
+        for (IndexColumn col : cols) {
             IndexColumn proxyCol = new IndexColumn();
+
             proxyCol.columnName = col.columnName;
             proxyCol.column = col.column;
             proxyCol.sortType = col.sortType;
 
             int altColId = desc.getAlternativeColumnId(proxyCol.column.getColumnId());
+
             if (altColId != proxyCol.column.getColumnId()) {
                 proxyCol.column = getColumn(altColId);
+
                 proxyCol.columnName = proxyCol.column.getName();
+
                 modified = true;
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
index 56f6667..39256d4 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
@@ -206,7 +206,7 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
         int seg = threadLocalSegment();
 
         // Fast path if we don't need to perform any filtering.
-        if (f == null || f.forSpace((getTable()).spaceName()) == null)
+        if (f == null || f.forSpace((getTable()).cacheName()) == null)
             try {
                 return treeForRead(seg).size();
             } catch (IgniteCheckedException e) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlDropIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlDropIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlDropIndex.java
index c844b49..f3250b0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlDropIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlDropIndex.java
@@ -24,7 +24,7 @@ import org.h2.command.Parser;
  */
 public class GridSqlDropIndex extends GridSqlStatement {
     /** Index name. */
-    private String name;
+    private String idxName;
 
     /** Schema name. */
     private String schemaName;
@@ -35,15 +35,15 @@ public class GridSqlDropIndex extends GridSqlStatement {
     /**
      * @return Index name.
      */
-    public String name() {
-        return name;
+    public String indexName() {
+        return idxName;
     }
 
     /**
-     * @param name Index name.
+     * @param idxName Index name.
      */
-    public void name(String name) {
-        this.name = name;
+    public void indexName(String idxName) {
+        this.idxName = idxName;
     }
 
     /**
@@ -77,6 +77,6 @@ public class GridSqlDropIndex extends GridSqlStatement {
     /** {@inheritDoc} */
     @Override public String getSQL() {
         return "DROP INDEX " + (ifExists ? "IF EXISTS " : "") + Parser.quoteIdentifier(schemaName) + '.' +
-            Parser.quoteIdentifier(name);
+            Parser.quoteIdentifier(idxName);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index 13d4237..71c77ac 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -725,7 +725,7 @@ public class GridSqlQueryParser {
     private GridSqlDropIndex parseDropIndex(DropIndex dropIdx) {
         GridSqlDropIndex res = new GridSqlDropIndex();
 
-        res.name(DROP_INDEX_NAME.get(dropIdx));
+        res.indexName(DROP_INDEX_NAME.get(dropIdx));
         res.schemaName(SCHEMA_COMMAND_SCHEMA.get(dropIdx).getName());
         res.ifExists(DROP_INDEX_IF_EXISTS.get(dropIdx));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/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 6621bb4..1241d0c 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
@@ -351,7 +351,9 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
         final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
         try {
-            queryProcessor(node()).dynamicIndexCreate(randomString(), TBL_NAME, idx, false).get();
+            String cacheName = randomString();
+
+            queryProcessor(node()).dynamicIndexCreate(cacheName, cacheName, TBL_NAME, idx, false).get();
         }
         catch (SchemaOperationException e) {
             assertEquals(SchemaOperationException.CODE_CACHE_NOT_FOUND, e.code());
@@ -844,7 +846,9 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
         initialize(mode, atomicityMode, near);
 
         try {
-            queryProcessor(node()).dynamicIndexDrop(randomString(), "my_idx", false).get();
+            String cacheName = randomString();
+
+            queryProcessor(node()).dynamicIndexDrop(cacheName, cacheName, "my_idx", false).get();
         }
         catch (SchemaOperationException e) {
             assertEquals(SchemaOperationException.CODE_CACHE_NOT_FOUND, e.code());

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/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 ae86933..f9e2f75 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
@@ -39,10 +39,12 @@ import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisito
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import javax.cache.Cache;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
@@ -148,7 +150,8 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
 
         QueryIndex idx1 = index(IDX_NAME_1, field(FIELD_NAME_1));
 
-        IgniteInternalFuture<?> idxFut1 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx1, false);
+        IgniteInternalFuture<?> idxFut1 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME,
+            idx1, false);
 
         Thread.sleep(100);
 
@@ -168,7 +171,8 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
 
         QueryIndex idx2 = index(IDX_NAME_2, field(alias(FIELD_NAME_2)));
 
-        IgniteInternalFuture<?> idxFut2 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx2, false);
+        IgniteInternalFuture<?> idxFut2 =
+            queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false);
 
         Thread.sleep(100);
 
@@ -203,8 +207,11 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         QueryIndex idx1 = index(IDX_NAME_1, field(FIELD_NAME_1));
         QueryIndex idx2 = index(IDX_NAME_2, field(alias(FIELD_NAME_2)));
 
-        IgniteInternalFuture<?> idxFut1 = queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx1, false);
-        IgniteInternalFuture<?> idxFut2 = queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx2, false);
+        IgniteInternalFuture<?> idxFut1 =
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx1, false);
+
+        IgniteInternalFuture<?> idxFut2 =
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false);
 
         // Start even more nodes of different flavors
         Ignition.start(serverConfiguration(5));
@@ -247,7 +254,8 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
 
         QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
-        IgniteInternalFuture<?> idxFut = queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+        IgniteInternalFuture<?> idxFut =
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
 
         Ignition.start(serverConfiguration(2));
         Ignition.start(serverConfiguration(3, true));
@@ -317,7 +325,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         // Create index.
         QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
-        queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+        queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
 
         // Stop updates once index is ready.
         stopped.set(true);
@@ -389,7 +397,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, TBL_NAME, idx, false);
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
 
         Thread.sleep(100);
 
@@ -437,7 +445,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, TBL_NAME, idx, false);
+            queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
 
         Thread.sleep(100);
 
@@ -487,12 +495,12 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
                     IgniteInternalFuture fut;
 
                     if (exists) {
-                        fut = queryProcessor(node).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
+                        fut = queryProcessor(node).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, true);
 
                         exists = false;
                     }
                     else {
-                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
+                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true);
 
                         exists = true;
                     }
@@ -519,8 +527,8 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         // Make sure nothing hanged.
         idxFut.get();
 
-        queryProcessor(cli).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true).get();
-        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true).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();
 
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
 
@@ -563,12 +571,12 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
                     IgniteInternalFuture fut;
 
                     if (exists) {
-                        fut = queryProcessor(node).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
+                        fut = queryProcessor(node).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, true);
 
                         exists = false;
                     }
                     else {
-                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
+                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true);
 
                         exists = true;
                     }
@@ -649,7 +657,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, TBL_NAME, idx, false).get();
+                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
             }
         });
 
@@ -660,7 +668,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         reconnectClientNode(srv, cli, restartCache, new RunnableX() {
             @Override public void run() throws Exception {
                 if (!restartCache)
-                    queryProcessor(srv).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, false).get();
+                    queryProcessor(srv).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, false).get();
             }
         });
 
@@ -670,7 +678,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         // Update existing index.
         QueryIndex idx = index(IDX_NAME_2, field(alias(FIELD_NAME_2)));
 
-        queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+        queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
 
         assertIndex(cli, true, CACHE_NAME, TBL_NAME, IDX_NAME_2, field(alias(FIELD_NAME_2)));
         assertIndexUsed(IDX_NAME_2, SQL_SIMPLE_FIELD_2, SQL_ARG_2);
@@ -678,11 +686,11 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         reconnectClientNode(srv, cli, restartCache, new RunnableX() {
             @Override public void run() throws Exception {
                 if (!restartCache)
-                    queryProcessor(srv).dynamicIndexDrop(CACHE_NAME, IDX_NAME_2, false).get();
+                    queryProcessor(srv).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_2, false).get();
 
                 final QueryIndex idx = index(IDX_NAME_2, field(FIELD_NAME_1), field(alias(FIELD_NAME_2)));
 
-                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
+                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
             }
         });
 
@@ -800,12 +808,12 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
                     IgniteInternalFuture fut;
 
                     if (exists) {
-                        fut = queryProcessor(node).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
+                        fut = queryProcessor(node).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, true);
 
                         exists = false;
                     }
                     else {
-                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
+                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true);
 
                         exists = true;
                     }
@@ -836,8 +844,8 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         // Make sure cache is operational at this point.
         cli.getOrCreateCache(cacheConfiguration());
 
-        queryProcessor(cli).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true).get();
-        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true).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();
 
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
 
@@ -901,12 +909,12 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
                     IgniteInternalFuture fut;
 
                     if (exists) {
-                        fut = queryProcessor(node).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
+                        fut = queryProcessor(node).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, true);
 
                         exists = false;
                     }
                     else {
-                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
+                        fut = queryProcessor(node).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, true);
 
                         exists = true;
                     }
@@ -937,8 +945,8 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         // Make sure cache is operational at this point.
         cli.getOrCreateCache(cacheConfiguration());
 
-        queryProcessor(cli).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true).get();
-        queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true).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();
 
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/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 5a00345..71244bb 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
@@ -469,7 +469,7 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
                 final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
 
                 try {
-                    queryProcessor(node1).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+                    queryProcessor(node1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
                 }
                 catch (IgniteCheckedException e) {
                     throw new IgniteException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef78264/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index 6d0c6ac..21666d6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -591,7 +591,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
      * Test two instances of {@link GridSqlDropIndex} for equality.
      */
     private static void assertDropIndexEquals(GridSqlDropIndex exp, GridSqlDropIndex actual) {
-        assertEqualsIgnoreCase(exp.name(), actual.name());
+        assertEqualsIgnoreCase(exp.indexName(), actual.indexName());
         assertEqualsIgnoreCase(exp.schemaName(), actual.schemaName());
         assertEquals(exp.ifExists(), actual.ifExists());
     }
@@ -602,7 +602,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
     private static GridSqlDropIndex buildDropIndex(String name, String schema, boolean ifExists) {
         GridSqlDropIndex res = new GridSqlDropIndex();
 
-        res.name(name);
+        res.indexName(name);
         res.schemaName(schema);
         res.ifExists(ifExists);
 


Mime
View raw message