#ignite-gg-9966: move ATTR_BUILD_DATE to NodeVersionValidatorProcessor.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6dc40be9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6dc40be9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6dc40be9 Branch: refs/heads/ignite-sprint-3 Commit: 6dc40be9537e44adc86ac4f5135ece6647e7b468 Parents: 1f33711 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Apr 3 12:20:30 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Apr 3 12:20:30 2015 +0300 ---------------------------------------------------------------------- .../ignite/internal/GridKernalContextImpl.java | 2 +- .../apache/ignite/internal/IgniteKernal.java | 7 +- .../internal/processors/spi/NodeValidator.java | 27 ------- .../spi/NodeVersionValidatorProcessor.java | 27 +++++++ .../processors/spi/OsNodeValidator.java | 79 ------------------- .../spi/OsNodeVersionValidatorProcessor.java | 80 ++++++++++++++++++++ 6 files changed, 111 insertions(+), 111 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6dc40be9/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 67d0a49..e999a49 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 @@ -476,7 +476,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable dataStructuresProc = (DataStructuresProcessor)comp; else if (comp instanceof ClusterProcessor) cluster = (ClusterProcessor)comp; - else if (!(comp instanceof NodeValidator)) + else if (!(comp instanceof NodeVersionValidatorProcessor)) assert (comp instanceof GridPluginComponent) : "Unknown manager class: " + comp.getClass(); if (addToList) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6dc40be9/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 c5871b6..48109931 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 @@ -735,7 +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(NodeValidator.class, ctx)); + startProcessor(createComponent(NodeVersionValidatorProcessor.class, ctx)); startProcessor(new GridClockSyncProcessor(ctx)); startProcessor(new GridAffinityProcessor(ctx)); startProcessor(createComponent(GridSegmentationProcessor.class, ctx)); @@ -1157,7 +1157,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { // Stick in some system level attributes add(ATTR_JIT_NAME, U.getCompilerMx() == null ? "" : U.getCompilerMx().getName()); - add(ATTR_BUILD_DATE, BUILD_TSTAMP_STR); add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName()); add(ATTR_USER_NAME, System.getProperty("user.name")); add(ATTR_GRID_NAME, gridName); @@ -2727,8 +2726,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { if (cls.equals(IgniteCacheObjectProcessor.class)) return (T)new IgniteCacheObjectProcessorImpl(ctx); - if (cls.equals(NodeValidator.class)) - return (T)new OsNodeValidator(ctx); + if (cls.equals(NodeVersionValidatorProcessor.class)) + return (T)new OsNodeVersionValidatorProcessor(ctx); Class<T> implCls = null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6dc40be9/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 deleted file mode 100644 index ba74e1b..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeValidator.java +++ /dev/null @@ -1,27 +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.spi; - -import org.apache.ignite.internal.processors.*; - -/** - * Node Validator. - */ -public interface NodeValidator extends GridProcessor { - //No-op. -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6dc40be9/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeVersionValidatorProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeVersionValidatorProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeVersionValidatorProcessor.java new file mode 100644 index 0000000..5ac1af0 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/NodeVersionValidatorProcessor.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.processors.*; + +/** + * Node Version Validator. + */ +public interface NodeVersionValidatorProcessor extends GridProcessor { + //No-op. +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6dc40be9/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 deleted file mode 100644 index 923d0ac..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeValidator.java +++ /dev/null @@ -1,79 +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.spi; - -import org.apache.ignite.*; -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 static org.apache.ignite.internal.IgniteNodeAttributes.*; -import static org.apache.ignite.internal.IgniteVersionUtils.VER_STR; - -/** - * Node validator. - */ -public class OsNodeValidator extends GridProcessorAdapter implements NodeValidator { - /** - * @param ctx Kernal context. - */ - public OsNodeValidator(GridKernalContext ctx) { - super(ctx); - } - - /** {@inheritDoc} */ - @Override public void start() throws IgniteCheckedException { - ctx.addNodeAttribute(ATTR_BUILD_VER, VER_STR); - } - - /** {@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/6dc40be9/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeVersionValidatorProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeVersionValidatorProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeVersionValidatorProcessor.java new file mode 100644 index 0000000..3d151f3 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/spi/OsNodeVersionValidatorProcessor.java @@ -0,0 +1,80 @@ +/* + * 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.*; +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 static org.apache.ignite.internal.IgniteNodeAttributes.*; +import static org.apache.ignite.internal.IgniteVersionUtils.*; + +/** + * Node validator. + */ +public class OsNodeVersionValidatorProcessor extends GridProcessorAdapter implements NodeVersionValidatorProcessor { + /** + * @param ctx Kernal context. + */ + public OsNodeVersionValidatorProcessor(GridKernalContext ctx) { + super(ctx); + } + + /** {@inheritDoc} */ + @Override public void start() throws IgniteCheckedException { + ctx.addNodeAttribute(ATTR_BUILD_VER, VER_STR); + ctx.addNodeAttribute(ATTR_BUILD_DATE, BUILD_TSTAMP_STR); + } + + /** {@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; + } +}