Repository: ignite
Updated Branches:
  refs/heads/ignite-4565-ddl d6e5028db -> b6f49269e


WIP.


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

Branch: refs/heads/ignite-4565-ddl
Commit: b6f49269ebc881797c37f5f7fa323e46fb23e48d
Parents: d6e5028
Author: devozerov <voze...@gridgain.com>
Authored: Mon Mar 20 12:07:05 2017 +0300
Committer: devozerov <voze...@gridgain.com>
Committed: Mon Mar 20 12:07:05 2017 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    | 48 ++++++++++++++++++--
 1 file changed, 45 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b6f49269/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 339b878..6b9d9af 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
@@ -66,6 +66,7 @@ import 
org.apache.ignite.internal.processors.query.ddl.CreateIndexOperation;
 import 
org.apache.ignite.internal.processors.query.ddl.IndexAcceptDiscoveryMessage;
 import 
org.apache.ignite.internal.processors.query.ddl.IndexProposeDiscoveryMessage;
 import 
org.apache.ignite.internal.processors.query.ddl.task.IndexingCacheStartTask;
+import 
org.apache.ignite.internal.processors.query.ddl.task.IndexingCacheStopTask;
 import org.apache.ignite.internal.processors.query.ddl.task.IndexingTask;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
@@ -516,9 +517,7 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
             }
 
             // Clear indexes.
-            removeIndexesOnSpaceUnregister(space);
-
-            completeIndexClientFuturesOnSpaceUnregister(space, true);
+            idxWorker.onCacheStop(space);
 
             // Notify indexing.
             try {
@@ -1289,6 +1288,19 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
             // TODO Find coordinator.
 
             // TODO: Start processing tasks
+
+            while (!isCancelled()) {
+                IndexingTask task = tasks.take();
+
+                if (task != null) {
+                    if (task instanceof IndexingCacheStartTask)
+                        handleCacheStart((IndexingCacheStartTask)task);
+                    else if (task instanceof IndexingCacheStopTask)
+                        handleCacheStop((IndexingCacheStopTask)task);
+                    else
+                        U.warn(log, "Unsupported task: " + task);
+                }
+            }
         }
 
         /**
@@ -1311,6 +1323,36 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
         }
 
         /**
+         * Handle cache start task.
+         *
+         * @param task Task.
+         */
+        private void handleCacheStart(IndexingCacheStartTask task) {
+            // TODO: Start active operations.
+        }
+
+        /**
+         * Cache stopped callback.
+         *
+         * @param space Space.
+         */
+        public void onCacheStop(String space) {
+            submit(new IndexingCacheStopTask(space));
+        }
+
+        /**
+         * Handle cache stop task.
+         *
+         * @param task Task.
+         */
+        private void handleCacheStop(IndexingCacheStopTask task) {
+            // TODO: Correct implementation.
+            removeIndexesOnSpaceUnregister(task.space());
+
+            completeIndexClientFuturesOnSpaceUnregister(task.space(), true);
+        }
+
+        /**
          * Update topology in response to node leave event.
          */
         private void updateTopology() {

Reply via email to