ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/46] incubator-ignite git commit: #ignite-gg-9966: Add node validator processor.
Date Mon, 06 Apr 2015 17:36:40 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-366 51ec52e1a -> cd0247467 (forced update)


#ignite-gg-9966: Add node validator processor.


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

Branch: refs/heads/ignite-366
Commit: cfa3a96f6d4c17bd20c8648b3872ff928fd95be1
Parents: 07ca9fa
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Apr 2 16:55:02 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Apr 2 16:55:02 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridKernalContextImpl.java  |   3 +-
 .../org/apache/ignite/internal/IgniteEx.java    |   7 --
 .../apache/ignite/internal/IgniteKernal.java    |  25 +----
 .../ignite/internal/IgniteNodeAttributes.java   |   3 -
 .../internal/processors/spi/NodeValidator.java  |  27 +++++
 .../processors/spi/OsNodeValidator.java         |  75 +++++++++++++
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 104 -------------------
 .../HadoopDefaultMapReducePlannerSelfTest.java  |   5 -
 8 files changed, 109 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cfa3a96f/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 845344b..a28c09c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -53,6 +53,7 @@ import org.apache.ignite.internal.processors.security.*;
 import org.apache.ignite.internal.processors.segmentation.*;
 import org.apache.ignite.internal.processors.service.*;
 import org.apache.ignite.internal.processors.session.*;
+import org.apache.ignite.internal.processors.spi.*;
 import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.processors.timeout.*;
 import org.apache.ignite.internal.util.*;
@@ -475,7 +476,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
             dataStructuresProc = (DataStructuresProcessor)comp;
         else if (comp instanceof ClusterProcessor)
             cluster = (ClusterProcessor)comp;
-        else
+        else if (!(comp instanceof OsNodeValidator))
             assert (comp instanceof GridPluginComponent) : "Unknown manager class: " + comp.getClass();
 
         if (addToList)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cfa3a96f/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index b8c1e11..867e26d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -88,13 +88,6 @@ public interface IgniteEx extends Ignite {
     public boolean allEventsUserRecordable(int[] types);
 
     /**
-     * Gets list of compatible versions.
-     *
-     * @return Compatible versions.
-     */
-    public Collection<String> compatibleVersions();
-
-    /**
      * Whether or not remote JMX management is enabled for this node.
      *
      * @return {@code True} if remote JMX management is enabled - {@code false} otherwise.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cfa3a96f/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 2789a0c..530613d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -56,6 +56,7 @@ import org.apache.ignite.internal.processors.security.*;
 import org.apache.ignite.internal.processors.segmentation.*;
 import org.apache.ignite.internal.processors.service.*;
 import org.apache.ignite.internal.processors.session.*;
+import org.apache.ignite.internal.processors.spi.*;
 import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.processors.timeout.*;
 import org.apache.ignite.internal.util.*;
@@ -98,9 +99,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Compatible versions. */
-    private static final String COMPATIBLE_VERS = IgniteProperties.get("ignite.compatible.vers");
-
     /** Ignite site that is shown in log messages. */
     static final String SITE = "ignite.incubator.apache.org";
 
@@ -189,10 +187,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     @GridToStringExclude
     private final AtomicReference<GridKernalGateway> gw = new AtomicReference<>();
 
-    /** */
-    @GridToStringExclude
-    private final Collection<String> compatibleVers;
-
     /** Stop guard. */
     @GridToStringExclude
     private final AtomicBoolean stopGuard = new AtomicBoolean();
@@ -213,13 +207,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
      */
     public IgniteKernal(@Nullable GridSpringResourceContext rsrcCtx) {
         this.rsrcCtx = rsrcCtx;
-
-        String[] compatibleVers = COMPATIBLE_VERS.split(",");
-
-        for (int i = 0; i < compatibleVers.length; i++)
-            compatibleVers[i] = compatibleVers[i].trim();
-
-        this.compatibleVers = Collections.unmodifiableList(Arrays.asList(compatibleVers));
     }
 
     /** {@inheritDoc} */
@@ -748,6 +735,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
 
             // Start processors before discovery manager, so they will
             // be able to start receiving messages once discovery completes.
+            startProcessor(createComponent(OsNodeValidator.class, ctx));
             startProcessor(new GridClockSyncProcessor(ctx));
             startProcessor(new GridAffinityProcessor(ctx));
             startProcessor(createComponent(GridSegmentationProcessor.class, ctx));
@@ -1171,7 +1159,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
         add(ATTR_JIT_NAME, U.getCompilerMx() == null ? "" : U.getCompilerMx().getName());
         add(ATTR_BUILD_VER, VER_STR);
         add(ATTR_BUILD_DATE, BUILD_TSTAMP_STR);
-        add(ATTR_COMPATIBLE_VERS, (Serializable)compatibleVersions());
         add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
         add(ATTR_USER_NAME, System.getProperty("user.name"));
         add(ATTR_GRID_NAME, gridName);
@@ -2568,11 +2555,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<String> compatibleVersions() {
-        return compatibleVers;
-    }
-
-    /** {@inheritDoc} */
     @Override public void close() throws IgniteException {
         Ignition.stop(gridName, true);
     }
@@ -2746,6 +2728,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
         if (cls.equals(IgniteCacheObjectProcessor.class))
             return (T)new IgniteCacheObjectProcessorImpl(ctx);
 
+        if (cls.equals(OsNodeValidator.class))
+            return (T)new OsNodeValidator(ctx);
+
         Class<T> implCls = null;
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cfa3a96f/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index d1a829e..98cc3a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -31,9 +31,6 @@ public final class IgniteNodeAttributes {
     public static final String ATTR_BUILD_DATE = ATTR_PREFIX + ".build.date";
 
     /** Internal attribute name constant. */
-    public static final String ATTR_COMPATIBLE_VERS = ATTR_PREFIX + ".compatible.vers";
-
-    /** Internal attribute name constant. */
     public static final String ATTR_MARSHALLER = ATTR_PREFIX + ".marshaller";
 
     /** Internal attribute name constant. */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cfa3a96f/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeValidator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeValidator.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeValidator.java
new file mode 100644
index 0000000..091deda
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeValidator.java
@@ -0,0 +1,27 @@
+/*
+ * 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.spi;
+
+import org.apache.ignite.internal.*;
+
+/**
+ * Node Validator.
+ */
+public interface NodeValidator extends GridComponent {
+    //No-op.
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cfa3a96f/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeValidator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeValidator.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeValidator.java
new file mode 100644
index 0000000..a350157
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeValidator.java
@@ -0,0 +1,75 @@
+/*
+ * 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.spi;
+
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+import static org.apache.ignite.internal.IgniteNodeAttributes.*;
+
+/**
+ * Node validator.
+ */
+public class OsNodeValidator extends GridProcessorAdapter implements NodeValidator {
+    /**
+     * @param ctx Kernal context.
+     */
+    public OsNodeValidator(GridKernalContext ctx) {
+        super(ctx);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public IgniteSpiNodeValidationResult validateNode(ClusterNode node)
{
+        ClusterNode locNode = ctx.discovery().localNode();
+
+        // Check version.
+        String locBuildVer = locNode.attribute(ATTR_BUILD_VER);
+        String rmtBuildVer = node.attribute(ATTR_BUILD_VER);
+
+        if (!F.eq(rmtBuildVer, locBuildVer)) {
+            // OS nodes don't support rolling updates.
+            if (!locBuildVer.equals(rmtBuildVer)) {
+                String errMsg = "Local node and remote node have different version numbers
" +
+                    "(node will not join, Ignite does not support rolling updates, " +
+                    "so versions must be exactly the same) " +
+                    "[locBuildVer=" + locBuildVer + ", rmtBuildVer=" + rmtBuildVer +
+                    ", locNodeAddrs=" + U.addressesAsString(locNode) +
+                    ", rmtNodeAddrs=" + U.addressesAsString(node) +
+                    ", locNodeId=" + locNode.id() + ", rmtNodeId=" + node.id() + ']';
+
+                LT.warn(log, null, errMsg);
+
+                // Always output in debug.
+                if (log.isDebugEnabled())
+                    log.debug(errMsg);
+
+                return new IgniteSpiNodeValidationResult(node.id(), errMsg, errMsg);
+            }
+
+        }
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cfa3a96f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index d5c05f7..d17f9b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -3254,110 +3254,6 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
                     return;
                 }
 
-                // Check version.
-                String locBuildVer = locNode.attribute(ATTR_BUILD_VER);
-                String rmtBuildVer = node.attribute(ATTR_BUILD_VER);
-
-                if (!F.eq(rmtBuildVer, locBuildVer)) {
-                    // OS nodes don't support rolling updates.
-                    if (!locBuildVer.equals(rmtBuildVer)) {
-                        String errMsg = "Local node and remote node have different version
numbers " +
-                            "(node will not join, Ignite does not support rolling updates,
" +
-                            "so versions must be exactly the same) " +
-                            "[locBuildVer=" + locBuildVer + ", rmtBuildVer=" + rmtBuildVer
+
-                            ", locNodeAddrs=" + U.addressesAsString(locNode) +
-                            ", rmtNodeAddrs=" + U.addressesAsString(node) +
-                            ", locNodeId=" + locNode.id() + ", rmtNodeId=" + msg.creatorNodeId()
+ ']';
-
-                        LT.warn(log, null, errMsg);
-
-                        // Always output in debug.
-                        if (log.isDebugEnabled())
-                            log.debug(errMsg);
-
-                        try {
-                            String sndMsg = "Local node and remote node have different version
numbers " +
-                                "(node will not join, Ignite does not support rolling updates,
" +
-                                "so versions must be exactly the same) " +
-                                "[locBuildVer=" + rmtBuildVer + ", rmtBuildVer=" + locBuildVer
+
-                                ", locNodeAddrs=" + U.addressesAsString(node) + ", locPort="
+ node.discoveryPort() +
-                                ", rmtNodeAddr=" + U.addressesAsString(locNode) + ", locNodeId="
+ node.id() +
-                                ", rmtNodeId=" + locNode.id() + ']';
-
-                            trySendMessageDirectly(node,
-                                    new TcpDiscoveryCheckFailedMessage(locNodeId, sndMsg));
-                        }
-                        catch (IgniteSpiException e) {
-                            if (log.isDebugEnabled())
-                                log.debug("Failed to send version check failed message to
node " +
-                                    "[node=" + node + ", err=" + e.getMessage() + ']');
-
-                            onException("Failed to send version check failed message to node
" +
-                                "[node=" + node + ", err=" + e.getMessage() + ']', e);
-                        }
-
-                        // Ignore join request.
-                        return;
-                    }
-
-                    Collection<String> locCompatibleVers = locNode.attribute(ATTR_COMPATIBLE_VERS);
-                    Collection<String> rmtCompatibleVers = node.attribute(ATTR_COMPATIBLE_VERS);
-
-                    if (F.contains(rmtCompatibleVers, locBuildVer) || F.contains(locCompatibleVers,
rmtBuildVer)) {
-                        String errMsg = "Local node's build version differs from remote node's,
" +
-                            "but they are compatible (will continue join process) " +
-                            "[locBuildVer=" + locBuildVer + ", rmtBuildVer=" + rmtBuildVer
+
-                            ", locNodeAddrs=" + U.addressesAsString(locNode) +
-                            ", rmtNodeAddrs=" + U.addressesAsString(node) +
-                            ", locNodeId=" + locNode.id() + ", rmtNodeId=" + msg.creatorNodeId()
+ ']';
-
-                        LT.warn(log, null, errMsg);
-
-                        // Always output in debug.
-                        if (log.isDebugEnabled())
-                            log.debug(errMsg);
-                    }
-                    else {
-                        String errMsg = "Local node's and remote node's build versions are
not compatible " +
-                            "(topologies built with different Ignite versions " +
-                            "are supported in Enterprise version only) "  +
-                            "[locBuildVer=" + locBuildVer + ", rmtBuildVer=" + rmtBuildVer
+
-                            ", locNodeAddrs=" + U.addressesAsString(locNode) +
-                            ", rmtNodeAddrs=" + U.addressesAsString(node) +
-                            ", locNodeId=" + locNode.id() + ", rmtNodeId=" + msg.creatorNodeId()
+ ']';
-
-                        LT.warn(log, null, errMsg);
-
-                        // Always output in debug.
-                        if (log.isDebugEnabled())
-                            log.debug(errMsg);
-
-                        try {
-                            String sndMsg = "Local node's and remote node's build versions
are not compatible " +
-                                "(topologies built with different Ignite versions " +
-                                "are supported in Enterprise version only) " +
-                                " [locBuildVer=" + rmtBuildVer + ", rmtBuildVer=" + locBuildVer
+
-                                ", locNodeAddrs=" + U.addressesAsString(node) + ", locPort="
+ node.discoveryPort() +
-                                ", rmtNodeAddr=" + U.addressesAsString(locNode) + ", locNodeId="
+ node.id() +
-                                ", rmtNodeId=" + locNode.id() + ']';
-
-                            trySendMessageDirectly(node,
-                                new TcpDiscoveryCheckFailedMessage(locNodeId, sndMsg));
-                        }
-                        catch (IgniteSpiException e) {
-                            if (log.isDebugEnabled())
-                                log.debug("Failed to send version check failed message to
node " +
-                                    "[node=" + node + ", err=" + e.getMessage() + ']');
-
-                            onException("Failed to send version check failed message to node
" +
-                                "[node=" + node + ", err=" + e.getMessage() + ']', e);
-                        }
-
-                        // Ignore join request.
-                        return;
-                    }
-                }
-
                 String locMarsh = locNode.attribute(ATTR_MARSHALLER);
                 String rmtMarsh = node.attribute(ATTR_MARSHALLER);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cfa3a96f/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
index 7075f2e..1ff8a0f 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
@@ -977,11 +977,6 @@ public class HadoopDefaultMapReducePlannerSelfTest extends HadoopAbstractSelfTes
         }
 
         /** {@inheritDoc} */
-        @Override public Collection<String> compatibleVersions() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
         @Override public boolean isJmxRemoteEnabled() {
             return false;
         }


Mime
View raw message