ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: Added node leave callback.
Date Mon, 20 Mar 2017 10:58:40 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4565-ddl c5dc40754 -> 7541f5680


Added node leave callback.


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

Branch: refs/heads/ignite-4565-ddl
Commit: 7541f56800c3d2a324ab8c1e72afb45a95a0fce5
Parents: c5dc407
Author: devozerov <vozerov@gridgain.com>
Authored: Mon Mar 20 13:58:30 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Mon Mar 20 13:58:30 2017 +0300

----------------------------------------------------------------------
 .../GridCachePartitionExchangeManager.java      |  5 ++
 .../processors/cache/GridCacheProcessor.java    |  6 ++
 .../processors/query/GridQueryProcessor.java    |  9 +++
 .../ddl/IndexNodeLeaveExchangeWorkerTask.java   | 58 ++++++++++++++++++++
 4 files changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7541f568/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index f7edb08..220d219 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -77,6 +77,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.query.ddl.IndexNodeLeaveExchangeWorkerTask;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
 import org.apache.ignite.internal.util.GridListSet;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -296,6 +297,10 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                     if (log.isDebugEnabled())
                         log.debug("Do not start exchange for discovery event: " + evt);
                 }
+
+                // Notify indexing engine about node leave so that we can re-map coordinator
accordingly.
+                if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED)
+                    exchWorker.addCustomTask(new IndexNodeLeaveExchangeWorkerTask(evt.eventNode()));
             }
             finally {
                 leaveBusy();

http://git-wip-us.apache.org/repos/asf/ignite/blob/7541f568/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 89629ea..82f5f19 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
@@ -71,6 +71,7 @@ import org.apache.ignite.internal.processors.query.ddl.IndexAbstractDiscoveryMes
 import org.apache.ignite.internal.processors.query.ddl.IndexAcceptDiscoveryMessage;
 import org.apache.ignite.internal.processors.query.ddl.IndexExchangeWorkerTask;
 import org.apache.ignite.internal.processors.query.ddl.IndexFinishDiscoveryMessage;
+import org.apache.ignite.internal.processors.query.ddl.IndexNodeLeaveExchangeWorkerTask;
 import org.apache.ignite.internal.processors.query.ddl.IndexProposeDiscoveryMessage;
 import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
 import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
@@ -412,6 +413,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             else
                 U.warn(log, "Unsupported index discovery message: " + msg);
         }
+        else if (task instanceof IndexNodeLeaveExchangeWorkerTask) {
+            IndexNodeLeaveExchangeWorkerTask task0 = (IndexNodeLeaveExchangeWorkerTask)task;
+
+            ctx.query().onNodeLeave(task0.node());
+        }
         else
             U.warn(log, "Unsupported custom exchange task: " + task);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7541f568/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 490d872..f92108e 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
@@ -365,6 +365,15 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * Handle node leave.
+     *
+     * @param node Node.
+     */
+    public void onNodeLeave(ClusterNode node) {
+        // TODO.
+    }
+
+    /**
      * Handle index init discovery message.
      *
      * @param space Space.

http://git-wip-us.apache.org/repos/asf/ignite/blob/7541f568/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/IndexNodeLeaveExchangeWorkerTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/IndexNodeLeaveExchangeWorkerTask.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/IndexNodeLeaveExchangeWorkerTask.java
new file mode 100644
index 0000000..3bb921b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/IndexNodeLeaveExchangeWorkerTask.java
@@ -0,0 +1,58 @@
+/*
+ * 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.ddl;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.cache.CachePartitionExchangeWorkerTask;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Node leave exchange worker task.
+ */
+public class IndexNodeLeaveExchangeWorkerTask implements CachePartitionExchangeWorkerTask
{
+    /** Node. */
+    @GridToStringInclude
+    private final ClusterNode node;
+
+    /**
+     * Constructor.
+     *
+     * @param node Node.
+     */
+    public IndexNodeLeaveExchangeWorkerTask(ClusterNode node) {
+        this.node = node;
+    }
+
+    /**
+     * @return Node.
+     */
+    public ClusterNode node() {
+        return node;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isExchange() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IndexNodeLeaveExchangeWorkerTask.class, this);
+    }
+}


Mime
View raw message