Repository: ignite
Updated Branches:
  refs/heads/ignite-4565-ddl e35c8eaf0 -> a371d251a


Minors.


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

Branch: refs/heads/ignite-4565-ddl
Commit: a371d251a9f6efa859a4359da43bce611cbdb7c3
Parents: e35c8ea
Author: devozerov <[email protected]>
Authored: Wed Mar 15 14:34:14 2017 +0300
Committer: devozerov <[email protected]>
Committed: Wed Mar 15 14:34:14 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java    |   2 +-
 .../cache/query/GridCacheQueryManager.java      |   9 --
 .../processors/query/GridQueryProcessor.java    | 140 +++++++++----------
 3 files changed, 70 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a371d251/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 7060eaa..28cd0a6 100755
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -2775,7 +2775,7 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
         if (idxStates == null || !idxStates.accept(msg))
             return;
 
-        // TODO: Initiate exchange-like routine!
+        ctx.query().onIndexAccept(op.space(), op);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/a371d251/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index ed96760..6277b8e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -537,15 +537,6 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
     }
 
     /**
-     * Validate index init discovery message.
-     *
-     * @param msg Message.
-     */
-    public void onIndexProposeMessage(IndexProposeDiscoveryMessage msg) {
-        qryProc.onIndexProposeMessage(space, msg);
-    }
-
-    /**
      * Undeploys given class loader.
      *
      * @param ldr Class loader to undeploy.

http://git-wip-us.apache.org/repos/asf/ignite/blob/a371d251/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 f4a1d50..0fb77eb 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
@@ -201,9 +201,8 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
 
         // Apply dynamic changes to candidates.
         if (idxStates != null) {
-            for (QueryTypeCandidate cand : cands) {
+            for (QueryTypeCandidate cand : cands)
                 applyInitialDelta(cand.descriptor(), idxStates);
-            }
         }
 
         // Ready to register at this point.
@@ -321,79 +320,78 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
      * Handle index init discovery message.
      *
      * @param space Space.
-     * @param msg Message.
+     * @param op Operation.
      */
-    // TODO: This should be done during accept phase.
-    public void onIndexProposeMessage(String space, 
IndexProposeDiscoveryMessage msg) {
-        // Validate.
+    public void onIndexAccept(String space, AbstractIndexOperation op) {
         idxLock.writeLock().lock();
 
-        try {
-            AbstractIndexOperation op = msg.operation();
-
-            if (op instanceof CreateIndexOperation) {
-                CreateIndexOperation op0 = (CreateIndexOperation)op;
-
-                QueryIndex idx = op0.index();
-
-                // Check conflict with other indexes.
-                String idxName = op0.index().getName();
-
-                QueryIndexKey idxKey = new QueryIndexKey(space, idxName);
-
-                QueryIndexDescriptorImpl oldIdx = idxs.get(idxKey);
-
-                if (oldIdx != null) {
-                    if (!op0.ifNotExists())
-                        msg.onError(ctx.localNodeId(), "Index already exists 
[space=" + space + ", index=" + idxName);
-
-                    return;
-                }
-
-                // Make sure table exists.
-                String tblName = op0.tableName();
-
-                QueryTypeDescriptorImpl typeDesc = null;
-
-                for (QueryTypeDescriptorImpl type : types.values()) {
-                    if (F.eq(tblName, type.tableName())) {
-                        typeDesc = type;
-
-                        break;
-                    }
-                }
-
-                if (typeDesc == null) {
-                    msg.onError(ctx.localNodeId(), "Table doesn't exist: " + 
tblName);
-
-                    return;
-                }
-
-                // Make sure that index can be applied to the given table.
-                for (String idxField : idx.getFieldNames()) {
-                    if (!typeDesc.fields().containsKey(idxField)) {
-                        msg.onError(ctx.localNodeId(), "Field doesn't exist: " 
+ idxField);
-
-                        return;
-                    }
-                }
-            }
-            else if (op instanceof DropIndexOperation) {
-                DropIndexOperation op0 = (DropIndexOperation)op;
-
-                String idxName = op0.indexName();
-
-                QueryIndexKey idxKey = new QueryIndexKey(space, idxName);
-
-                QueryIndexDescriptorImpl oldIdx = idxs.get(idxKey);
+        // TODO
 
-                if (oldIdx == null) {
-                    if (!op0.ifExists())
-                        msg.onError(ctx.localNodeId(), "Index doesn't exist: " 
+ idxName);
-                }
-            }
-            else
-                msg.onError(ctx.localNodeId(), "Unsupported operation: " + op);
+        try {
+//            // Validate.
+//            if (op instanceof CreateIndexOperation) {
+//                CreateIndexOperation op0 = (CreateIndexOperation)op;
+//
+//                QueryIndex idx = op0.index();
+//
+//                // Check conflict with other indexes.
+//                String idxName = op0.index().getName();
+//
+//                QueryIndexKey idxKey = new QueryIndexKey(space, idxName);
+//
+//                QueryIndexDescriptorImpl oldIdx = idxs.get(idxKey);
+//
+//                if (oldIdx != null) {
+//                    if (!op0.ifNotExists())
+//                        msg.onError(ctx.localNodeId(), "Index already exists 
[space=" + space + ", index=" + idxName);
+//
+//                    return;
+//                }
+//
+//                // Make sure table exists.
+//                String tblName = op0.tableName();
+//
+//                QueryTypeDescriptorImpl typeDesc = null;
+//
+//                for (QueryTypeDescriptorImpl type : types.values()) {
+//                    if (F.eq(tblName, type.tableName())) {
+//                        typeDesc = type;
+//
+//                        break;
+//                    }
+//                }
+//
+//                if (typeDesc == null) {
+//                    msg.onError(ctx.localNodeId(), "Table doesn't exist: " + 
tblName);
+//
+//                    return;
+//                }
+//
+//                // Make sure that index can be applied to the given table.
+//                for (String idxField : idx.getFieldNames()) {
+//                    if (!typeDesc.fields().containsKey(idxField)) {
+//                        msg.onError(ctx.localNodeId(), "Field doesn't exist: 
" + idxField);
+//
+//                        return;
+//                    }
+//                }
+//            }
+//            else if (op instanceof DropIndexOperation) {
+//                DropIndexOperation op0 = (DropIndexOperation)op;
+//
+//                String idxName = op0.indexName();
+//
+//                QueryIndexKey idxKey = new QueryIndexKey(space, idxName);
+//
+//                QueryIndexDescriptorImpl oldIdx = idxs.get(idxKey);
+//
+//                if (oldIdx == null) {
+//                    if (!op0.ifExists())
+//                        msg.onError(ctx.localNodeId(), "Index doesn't exist: 
" + idxName);
+//                }
+//            }
+//            else
+//                msg.onError(ctx.localNodeId(), "Unsupported operation: " + 
op);
         }
         finally {
             idxLock.writeLock().unlock();

Reply via email to