Skip to content

IGNITE-28731 Create cluster auto activation plugin#355

Open
DenisPolo wants to merge 3 commits into
apache:masterfrom
DenisPolo:ignite-28731
Open

IGNITE-28731 Create cluster auto activation plugin#355
DenisPolo wants to merge 3 commits into
apache:masterfrom
DenisPolo:ignite-28731

Conversation

@DenisPolo

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread .gigaide/gigaide.properties Outdated
@@ -0,0 +1,85 @@
Apache Ignite Auto Activation Plugin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace README.txt with README.md

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

</list>
</property>

<!-- Конфигурация TCP Discovery SPI -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use english language for comments

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, I changed it

</bean>

<bean id="ignConnectorConfiguration" class="org.apache.ignite.configuration.ConnectorConfiguration">
<!-- property name="host" value="0.0.0.0"/-->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not, deleted


/** {@inheritDoc} */
@Override public void validateNewNode(ClusterNode cn) throws PluginValidationException {
// do nothing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// do nothing
// No-op.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

cluster.state(ClusterState.ACTIVE);
}
else {
if (logger.isInfoEnabled()) logger.info("Auto activation skipped - activation condition not meet");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (logger.isInfoEnabled()) logger.info("Auto activation skipped - activation condition not meet");
if (logger.isInfoEnabled())
logger.info("Auto activation skipped - activation condition not meet");

@DenisPolo DenisPolo Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed all occurrences similar to this


missingNodes.remove(attrVal);

if (missingNodes.isEmpty()) break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (missingNodes.isEmpty()) break;
if (missingNodes.isEmpty())
break;

use new lines for body of if

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

this.requiredValues = requiredValues;
}

/** */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** */
/** {@inheritDoc} */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +1 to +18
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.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license goes first and package then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,135 @@
package opt.apache.ignite.activation;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add license

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +114 to +137
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");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add test for scenario with client nodes

@@ -0,0 +1,113 @@
<beans xmlns="http://www.springframework.org/schema/beans"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants