IGNITE-28731 Create cluster auto activation plugin#355
Conversation
| @@ -0,0 +1,85 @@ | |||
| Apache Ignite Auto Activation Plugin | |||
There was a problem hiding this comment.
Replace README.txt with README.md
| </list> | ||
| </property> | ||
|
|
||
| <!-- Конфигурация TCP Discovery SPI --> |
There was a problem hiding this comment.
Please, use english language for comments
There was a problem hiding this comment.
Sure thing, I changed it
| </bean> | ||
|
|
||
| <bean id="ignConnectorConfiguration" class="org.apache.ignite.configuration.ConnectorConfiguration"> | ||
| <!-- property name="host" value="0.0.0.0"/--> |
There was a problem hiding this comment.
Do we need this comment?
There was a problem hiding this comment.
Definitely not, deleted
|
|
||
| /** {@inheritDoc} */ | ||
| @Override public void validateNewNode(ClusterNode cn) throws PluginValidationException { | ||
| // do nothing |
There was a problem hiding this comment.
| // do nothing | |
| // No-op. |
| cluster.state(ClusterState.ACTIVE); | ||
| } | ||
| else { | ||
| if (logger.isInfoEnabled()) logger.info("Auto activation skipped - activation condition not meet"); |
There was a problem hiding this comment.
| if (logger.isInfoEnabled()) logger.info("Auto activation skipped - activation condition not meet"); | |
| if (logger.isInfoEnabled()) | |
| logger.info("Auto activation skipped - activation condition not meet"); |
There was a problem hiding this comment.
Fixed all occurrences similar to this
|
|
||
| missingNodes.remove(attrVal); | ||
|
|
||
| if (missingNodes.isEmpty()) break; |
There was a problem hiding this comment.
| if (missingNodes.isEmpty()) break; | |
| if (missingNodes.isEmpty()) | |
| break; |
use new lines for body of if
| this.requiredValues = requiredValues; | ||
| } | ||
|
|
||
| /** */ |
There was a problem hiding this comment.
| /** */ | |
| /** {@inheritDoc} */ |
| package opt.apache.ignite.activation; | ||
|
|
||
| /* | ||
| * 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. | ||
| */ |
There was a problem hiding this comment.
license goes first and package then
| @@ -0,0 +1,135 @@ | |||
| package opt.apache.ignite.activation; | |||
| if (cluster.state() == ClusterState.ACTIVE) { | ||
| if (logger.isInfoEnabled()) | ||
| logger.info("Auto activation skipped - cluster already activated"); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| if (cluster.currentBaselineTopology() != null) { | ||
| if (logger.isInfoEnabled()) | ||
| logger.info("Auto activation skipped - baseline is not empty"); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| if (condition.apply(cluster.nodes())) { | ||
| if (logger.isInfoEnabled()) | ||
| logger.info("Auto activation plugin set cluster state ACTIVE - activation condition meet"); | ||
|
|
||
| cluster.state(ClusterState.ACTIVE); | ||
| } | ||
| else { | ||
| if (logger.isInfoEnabled()) | ||
| logger.info("Auto activation skipped - activation condition not meet"); | ||
| } |
There was a problem hiding this comment.
Should ACTIVE_READ_ONLY be treated as already activated here? With the current check the plugin skips only ACTIVE and later calls cluster.state(ACTIVE), so a read-only cluster can be promoted to read-write mode by auto-activation. I think auto-activation should only activate INACTIVE clusters and leave ACTIVE_READ_ONLY unchanged.
Also add test for ACTIVE_READ_ONLY nodes
| return; | ||
| } | ||
|
|
||
| if (condition.apply(cluster.nodes())) { |
There was a problem hiding this comment.
Should this condition be evaluated only against server nodes? cluster.nodes() includes client nodes, so a client node with a matching consistentId or attribute can satisfy the activation condition and trigger cluster activation before the required server topology is actually present
WDYT?
There was a problem hiding this comment.
Also add test for scenario with client nodes
| @@ -0,0 +1,113 @@ | |||
| <beans xmlns="http://www.springframework.org/schema/beans" | |||
There was a problem hiding this comment.
These XML test configs duplicate most of the Ignite configuration. Can we move the common storage/cache/discovery/connector settings to a shared parent bean or common XML file, and keep only node-specific values here?
No description provided.