You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "DenisPolo (via GitHub)" <gi...@apache.org> on 2026/06/24 04:55:04 UTC

[PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

DenisPolo opened a new pull request, #355:
URL: https://github.com/apache/ignite-extensions/pull/355

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466737342


##########
modules/auto-activation-ext/README.txt:
##########
@@ -0,0 +1,85 @@
+Apache Ignite Auto Activation Plugin

Review Comment:
   Replace README.txt with README.md



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3783382021


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new LinkedHashSet<>(requiredValues);

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3465403765


##########
.gigaide/gigaide.properties:
##########
@@ -0,0 +1,1882 @@
+## changed at Wed Jun 24 14:13:56 VLAT 2026
+#Wed Jun 24 14:13:56 VLAT 2026
+com.gigaide.database.elements.stack.SqlFileStackElement.checkElement=true

Review Comment:
   Do we need this file?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524440285


##########
modules/auto-activation-ext/src/test/resources/activate-by-node-attribute/ignite-server-node3.xml:
##########
@@ -0,0 +1,114 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+  <bean abstract="false" class="org.apache.ignite.configuration.IgniteConfiguration">
+
+    <!-- Настройка региона -->
+    <property name="dataStorageConfiguration">
+      <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+        <property name="defaultDataRegionConfiguration">
+          <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+            <property name="initialSize" value="#{10 * 1024 * 1024}"/>
+            <property name="maxSize" value="#{15 * 1024 * 1024}"/>
+            <property name="name"                       value="default"/>
+            <property name="persistenceEnabled"         value="true"/>
+            <property name="metricsEnabled"             value="true"/>
+            <property name="pageReplacementMode"        value="SEGMENTED_LRU"/>
+          </bean>
+        </property>
+        <property name="walSegmentSize" value="#{2 * 1024 * 1024}" />
+        <property name="walSegments" value="10" />
+      </bean>
+    </property>
+
+    <!-- Другие свойства. -->
+    <property name="consistentId" value="cell-2_node-1"/>
+    <property name="igniteInstanceName" value="cell-2_node-1"/>
+
+    <!-- Настройка кеша -->
+    <property name="cacheConfiguration">
+      <list>
+        <bean class="org.apache.ignite.configuration.CacheConfiguration">
+          <property name="cacheMode" value="PARTITIONED"/>
+          <property name="affinity">
+            <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
+              <property name="partitions" value="32"/>
+              <property name="affinityBackupFilter">
+                <bean class="org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeColocatedBackupFilter">
+                  <constructor-arg value="CELL"/>
+                </bean>
+              </property>
+            </bean>
+          </property>
+          <property name="name" value="default"/>
+          <property name="atomicityMode" value="ATOMIC"/>
+          <property name="backups" value="1"/>
+        </bean>
+      </list>
+    </property>
+
+    <!-- Конфигурация TCP Discovery SPI -->

Review Comment:
   Sure thing, I changed it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3755590015


##########
modules/auto-activation-ext/src/test/resources/activate-by-consistent-ID/ignite-server-node1.xml:
##########
@@ -0,0 +1,113 @@
+<beans xmlns="http://www.springframework.org/schema/beans"

Review Comment:
   Great idea. Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3866496924


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,160 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet.
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "Apache Software Foundation";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3804231401


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new HashSet<>(requiredValues);
+
+        for (ClusterNode node : nodes) {
+            String attrVal = node.attribute(attrName);
+
+            missingNodes.remove(attrVal);
+
+            if (missingNodes.isEmpty())
+                break;
+        }
+
+        return missingNodes.isEmpty();
+    }

Review Comment:
   ```suggestion
       @Override public boolean apply(Collection<ClusterNode> nodes) {
           Set<String> missingNodes = new HashSet<>(requiredValues);
   
           for (ClusterNode node : nodes) {
               String attrVal = node.attribute(attrName);
   
               missingNodes.remove(attrVal);
   
               if (missingNodes.isEmpty())
                   return true;
           }
   
           return false;
       }
   ```



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByConsistentID.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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with specified ConsistentID values join topology.
+ */
+public class ActivateByConsistentID implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Collection of required nodes ConsistentIDs. */
+    private final Set<String> requiredNodes;
+
+    /**
+     * @param requiredNodes List of ConsistentIDs.
+     */
+    public ActivateByConsistentID(Set<String> requiredNodes) {
+        if (requiredNodes == null || requiredNodes.isEmpty())
+            throw new IllegalArgumentException("requiredNodes must be set");
+
+        this.requiredNodes = requiredNodes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new HashSet<>(requiredNodes);
+
+        for (ClusterNode node : nodes) {
+            String nodeConsistentId = node.consistentId().toString();
+
+            missingNodes.remove(nodeConsistentId);
+
+            if (missingNodes.isEmpty())
+                break;
+        }
+
+        return missingNodes.isEmpty();
+    }

Review Comment:
   ```suggestion
       @Override public boolean apply(Collection<ClusterNode> nodes) {
           Set<String> missingNodes = new HashSet<>(requiredNodes);
   
           for (ClusterNode node : nodes) {
               String nodeConsistentId = node.consistentId().toString();
   
               missingNodes.remove(nodeConsistentId);
   
               if (missingNodes.isEmpty())
                   return true;
           }
   
           return false;
       }
   ```



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {
+        ApplicationContext ctx = new ClassPathXmlApplicationContext("common-ignite-server-node.xml", xmlPath);
+
+        return ctx.getBean(IgniteConfiguration.class).setGridLogger(listeningLog);
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(nodesConsistentIds)
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdFirstTwoNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_0, NODE_1))
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertFalse(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdOnlyLastNode() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_2))
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodesPlusCacheConfig() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_2))
+        );
+

Review Comment:
   remove nl



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()

Review Comment:
   ```suggestion
       private CacheConfiguration<String, Integer> getCacheConfiguration() {
           return new CacheConfiguration<String, Integer>()
   ```



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()

Review Comment:
   let's avoid raw usage of type



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,160 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet.
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "Apache Software Foundation";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+

Review Comment:
   ```suggestion
   ```



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {

Review Comment:
   From IDEA:  Exception 'java.lang.Exception' is never thrown in the method 



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {
+        ApplicationContext ctx = new ClassPathXmlApplicationContext("common-ignite-server-node.xml", xmlPath);
+
+        return ctx.getBean(IgniteConfiguration.class).setGridLogger(listeningLog);
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(nodesConsistentIds)
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdFirstTwoNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_0, NODE_1))
+        );
+

Review Comment:
   remove nl



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {
+        ApplicationContext ctx = new ClassPathXmlApplicationContext("common-ignite-server-node.xml", xmlPath);
+
+        return ctx.getBean(IgniteConfiguration.class).setGridLogger(listeningLog);
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(nodesConsistentIds)
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdFirstTwoNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_0, NODE_1))
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertFalse(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdOnlyLastNode() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_2))
+        );
+

Review Comment:
   remove nl



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {
+        ApplicationContext ctx = new ClassPathXmlApplicationContext("common-ignite-server-node.xml", xmlPath);
+
+        return ctx.getBean(IgniteConfiguration.class).setGridLogger(listeningLog);
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(nodesConsistentIds)
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdFirstTwoNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_0, NODE_1))
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertFalse(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdOnlyLastNode() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_2))
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodesPlusCacheConfig() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_2))
+        );
+

Review Comment:
   same for other methods: remove empty lines as first lines in method bodies



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524442156


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,135 @@
+package opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStop(boolean bln) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public Serializable provideDiscoveryData(UUID uuid) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void receiveDiscoveryData(UUID uuid, Serializable srlzbl) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void validateNewNode(ClusterNode cn) throws PluginValidationException {
+        // do nothing

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524448663


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,135 @@
+package opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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");

Review Comment:
   Fixed all occurrences similar to this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3788201192


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466796756


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,681 @@
+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.
+ */

Review Comment:
   license goes first and package then



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524441823


##########
modules/auto-activation-ext/src/test/resources/activate-by-consistent-ID/ignite-server-node1.xml:
##########
@@ -0,0 +1,114 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+
+  <bean abstract="false" class="org.apache.ignite.configuration.IgniteConfiguration">
+    <!-- Настройка региона -->
+    <property name="dataStorageConfiguration">
+      <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+        <property name="defaultDataRegionConfiguration">
+          <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+            <property name="initialSize" value="#{10 * 1024 * 1024}"/>
+            <property name="maxSize" value="#{15 * 1024 * 1024}"/>
+            <property name="name"                       value="default"/>
+            <property name="persistenceEnabled"         value="true"/>
+            <property name="metricsEnabled"             value="true"/>
+            <property name="pageReplacementMode"        value="SEGMENTED_LRU"/>
+          </bean>
+        </property>
+        <property name="walSegmentSize" value="#{2 * 1024 * 1024}" />
+        <property name="walSegments" value="10" />
+      </bean>
+    </property>
+
+    <!-- Другие свойства. -->
+    <property name="consistentId" value="cell-1_node-1"/>
+    <property name="igniteInstanceName" value="cell-1_node-1"/>
+
+    <!-- Настройка кеша -->
+    <property name="cacheConfiguration">
+      <list>
+        <bean class="org.apache.ignite.configuration.CacheConfiguration">
+          <property name="cacheMode" value="PARTITIONED"/>
+          <property name="affinity">
+            <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
+              <property name="partitions" value="32"/>
+              <property name="affinityBackupFilter">
+                <bean class="org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeColocatedBackupFilter">
+                  <constructor-arg value="CELL"/>
+                </bean>
+              </property>
+            </bean>
+          </property>
+          <property name="name" value="default"/>
+          <property name="atomicityMode" value="ATOMIC"/>
+          <property name="backups" value="1"/>
+        </bean>
+      </list>
+    </property>
+
+    <!-- Конфигурация TCP Discovery SPI -->
+    <property name="discoverySpi">
+      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+        <property name="ipFinder">
+          <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+            <property name="addresses">
+              <list>
+                <value>127.0.0.1:47500..47600</value>
+              </list>
+            </property>
+          </bean>
+        </property>
+      </bean>
+    </property>
+
+    <property name="clientConnectorConfiguration">
+      <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
+        <property  name="threadPoolSize"  value="128" />
+        <property  name="thinClientEnabled"  value="true" />
+        <property name="thinClientConfiguration">
+          <bean class="org.apache.ignite.configuration.ThinClientConfiguration">
+            <property  name="maxActiveComputeTasksPerConnection"  value="1000" />
+          </bean>
+        </property>
+      </bean>
+    </property>
+
+    <!-- Разделение на ячейки -->
+    <property name="userAttributes">
+      <map>
+        <entry key="CELL" value="CELL_1"/>
+      </map>
+    </property>
+
+    <property name="connectorConfiguration" ref="ignConnectorConfiguration"/>
+
+    <property name="pluginProviders">
+      <bean class="opt.apache.ignite.activation.AutoActivationPluginProvider">
+        <constructor-arg name="condition" ref="condition" />
+      </bean>
+    </property>
+  </bean>
+
+  <bean id="condition" class="opt.apache.ignite.activation.ActivateByConsistentID">
+    <constructor-arg name="requiredNodes">
+      <util:set>
+        <value>cell-1_node-1</value>
+        <value>cell-1_node-2</value>
+        <value>cell-2_node-1</value>
+      </util:set>
+    </constructor-arg>
+  </bean>
+
+  <bean id="ignConnectorConfiguration" class="org.apache.ignite.configuration.ConnectorConfiguration">
+    <!-- property name="host"          value="0.0.0.0"/-->

Review Comment:
   Definitely not, deleted



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524449158


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,48 @@
+package opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new LinkedHashSet<String>(requiredValues);
+
+        for (ClusterNode node : nodes) {
+            String attrVal = node.attribute(attrName);
+
+            missingNodes.remove(attrVal);
+
+            if (missingNodes.isEmpty()) break;

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3755578415


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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())) {

Review Comment:
   This is a fair point. I added throwing an 'IgniteException' when a client node is included in the 'conditions' for auto-activation and tests



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3780572355


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        if (cluster.state() == ClusterState.ACTIVE || cluster.state() == ClusterState.ACTIVE_READ_ONLY) {
+            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");
+        }
+    }

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3860294459


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByConsistentID.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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with specified ConsistentID values join topology.
+ */
+public class ActivateByConsistentID implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Collection of required nodes ConsistentIDs. */
+    private final Set<String> requiredNodes;
+
+    /**
+     * @param requiredNodes List of ConsistentIDs.
+     */
+    public ActivateByConsistentID(Set<String> requiredNodes) {
+        if (requiredNodes == null || requiredNodes.isEmpty())
+            throw new IllegalArgumentException("requiredNodes must be set");
+
+        this.requiredNodes = requiredNodes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new HashSet<>(requiredNodes);
+
+        for (ClusterNode node : nodes) {
+            String nodeConsistentId = node.consistentId().toString();
+
+            missingNodes.remove(nodeConsistentId);
+
+            if (missingNodes.isEmpty())
+                break;
+        }
+
+        return missingNodes.isEmpty();
+    }

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466755540


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,135 @@
+package opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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");

Review Comment:
   ```suggestion
               if (logger.isInfoEnabled()) 
                   logger.info("Auto activation skipped - activation condition not meet");
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524059098


##########
.gigaide/gigaide.properties:
##########
@@ -0,0 +1,1882 @@
+## changed at Wed Jun 24 14:13:56 VLAT 2026
+#Wed Jun 24 14:13:56 VLAT 2026
+com.gigaide.database.elements.stack.SqlFileStackElement.checkElement=true

Review Comment:
   Of course not, I deleted it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524456475


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,681 @@
+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.
+ */

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3570417268


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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())) {

Review Comment:
   Also add test for scenario with client nodes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3780560016


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByConsistentID.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with specified ConsistentID values join topology.
+ */
+public class ActivateByConsistentID implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Collection of required nodes ConsistentIDs. */
+    private final Set<String> requiredNodes;
+
+    /**
+     * @param requiredNodes List of ConsistentIDs.
+     */
+    public ActivateByConsistentID(Set<String> requiredNodes) {
+        if (requiredNodes == null || requiredNodes.isEmpty())
+            throw new IllegalArgumentException("requiredNodes must be set");
+
+        this.requiredNodes = requiredNodes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new LinkedHashSet<>(requiredNodes);

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3788429171


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,735 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * {@link AutoActivationPluginProvider} test
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        final IgniteConfiguration igniteConfiguration = super.getConfiguration(igniteInstanceName);
+
+        switch (igniteInstanceName) {
+            case NODE_0:
+                igniteConfiguration.setConsistentId(NODE_0);
+                break;
+
+            case NODE_1:
+                igniteConfiguration.setConsistentId(NODE_1);
+                break;
+
+            case NODE_2:
+                igniteConfiguration.setConsistentId(NODE_2);
+                break;
+
+            default: throw new IllegalArgumentException("Unknown node: " + igniteInstanceName);
+        }

Review Comment:
   Oh, this is much better! Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3866500111


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466744740


##########
modules/auto-activation-ext/src/test/resources/activate-by-consistent-ID/ignite-server-node1.xml:
##########
@@ -0,0 +1,114 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+
+  <bean abstract="false" class="org.apache.ignite.configuration.IgniteConfiguration">
+    <!-- Настройка региона -->
+    <property name="dataStorageConfiguration">
+      <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+        <property name="defaultDataRegionConfiguration">
+          <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+            <property name="initialSize" value="#{10 * 1024 * 1024}"/>
+            <property name="maxSize" value="#{15 * 1024 * 1024}"/>
+            <property name="name"                       value="default"/>
+            <property name="persistenceEnabled"         value="true"/>
+            <property name="metricsEnabled"             value="true"/>
+            <property name="pageReplacementMode"        value="SEGMENTED_LRU"/>
+          </bean>
+        </property>
+        <property name="walSegmentSize" value="#{2 * 1024 * 1024}" />
+        <property name="walSegments" value="10" />
+      </bean>
+    </property>
+
+    <!-- Другие свойства. -->
+    <property name="consistentId" value="cell-1_node-1"/>
+    <property name="igniteInstanceName" value="cell-1_node-1"/>
+
+    <!-- Настройка кеша -->
+    <property name="cacheConfiguration">
+      <list>
+        <bean class="org.apache.ignite.configuration.CacheConfiguration">
+          <property name="cacheMode" value="PARTITIONED"/>
+          <property name="affinity">
+            <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
+              <property name="partitions" value="32"/>
+              <property name="affinityBackupFilter">
+                <bean class="org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeColocatedBackupFilter">
+                  <constructor-arg value="CELL"/>
+                </bean>
+              </property>
+            </bean>
+          </property>
+          <property name="name" value="default"/>
+          <property name="atomicityMode" value="ATOMIC"/>
+          <property name="backups" value="1"/>
+        </bean>
+      </list>
+    </property>
+
+    <!-- Конфигурация TCP Discovery SPI -->
+    <property name="discoverySpi">
+      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+        <property name="ipFinder">
+          <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+            <property name="addresses">
+              <list>
+                <value>127.0.0.1:47500..47600</value>
+              </list>
+            </property>
+          </bean>
+        </property>
+      </bean>
+    </property>
+
+    <property name="clientConnectorConfiguration">
+      <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
+        <property  name="threadPoolSize"  value="128" />
+        <property  name="thinClientEnabled"  value="true" />
+        <property name="thinClientConfiguration">
+          <bean class="org.apache.ignite.configuration.ThinClientConfiguration">
+            <property  name="maxActiveComputeTasksPerConnection"  value="1000" />
+          </bean>
+        </property>
+      </bean>
+    </property>
+
+    <!-- Разделение на ячейки -->
+    <property name="userAttributes">
+      <map>
+        <entry key="CELL" value="CELL_1"/>
+      </map>
+    </property>
+
+    <property name="connectorConfiguration" ref="ignConnectorConfiguration"/>
+
+    <property name="pluginProviders">
+      <bean class="opt.apache.ignite.activation.AutoActivationPluginProvider">
+        <constructor-arg name="condition" ref="condition" />
+      </bean>
+    </property>
+  </bean>
+
+  <bean id="condition" class="opt.apache.ignite.activation.ActivateByConsistentID">
+    <constructor-arg name="requiredNodes">
+      <util:set>
+        <value>cell-1_node-1</value>
+        <value>cell-1_node-2</value>
+        <value>cell-2_node-1</value>
+      </util:set>
+    </constructor-arg>
+  </bean>
+
+  <bean id="ignConnectorConfiguration" class="org.apache.ignite.configuration.ConnectorConfiguration">
+    <!-- property name="host"          value="0.0.0.0"/-->

Review Comment:
   Do we need this comment?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466749344


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,135 @@
+package opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStop(boolean bln) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public Serializable provideDiscoveryData(UUID uuid) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void receiveDiscoveryData(UUID uuid, Serializable srlzbl) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void validateNewNode(ClusterNode cn) throws PluginValidationException {
+        // do nothing

Review Comment:
   ```suggestion
           // No-op.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466761178


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,48 @@
+package opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new LinkedHashSet<String>(requiredValues);
+
+        for (ClusterNode node : nodes) {
+            String attrVal = node.attribute(attrName);
+
+            missingNodes.remove(attrVal);
+
+            if (missingNodes.isEmpty()) break;

Review Comment:
   ```suggestion
               if (missingNodes.isEmpty())
                   break;
   ```
   use new lines for body of `if`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524438706


##########
modules/auto-activation-ext/README.txt:
##########
@@ -0,0 +1,85 @@
+Apache Ignite Auto Activation Plugin

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524448663


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,135 @@
+package opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // do nothing
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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");

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524454039


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,48 @@
+package opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** */

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "shishkovilja (via GitHub)" <gi...@apache.org>.
shishkovilja commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r4185230883


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByConsistentID.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteMessaging;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with specified ConsistentID values join topology.

Review Comment:
   1. Replace with one-line comment, here and in other similar places, please.
   2. Fix description too, currently Javadoc sounds like one for a method, not a predicate class.



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteMessaging;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.

Review Comment:
   1. Replace with one-line comment, here and in other similar places, please.
   2. Fix description too, currently Javadoc sounds like one for a method, not a predicate class.



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,163 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet.
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Ignite> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Ignite> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "Apache Software Foundation";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider<?> createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+        grid.message(grid.cluster().forServers()).localListen(

Review Comment:
   Why do we need messaging at all? Why just not print result of predicate call?



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########


Review Comment:
   Tests looks too complicated and generic. I think it at least can be refactored as parametrized one.



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByConsistentID.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * 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 opt.apache.ignite.activation;

Review Comment:
   ```suggestion
   package org.apache.ignite.activation;
   ```



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,457 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private LogListener lsnrMissed;
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final String ATTR_VAL3 = "CELL_03";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setUserAttributes(igniteInstanceName.equals(NODE_2) ? Map.of(ATTR, ATTR_VAL2) : Map.of(ATTR, ATTR_VAL1))
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** */
+    private IgniteConfiguration getConfiguration(String igniteInstanceName, PluginProvider<?> autoActivationProvider,
+                                                 String extraCfg) throws Exception {
+        IgniteConfiguration cfg = getConfiguration(igniteInstanceName).setPluginProviders(autoActivationProvider);
+
+        if (extraCfg != null) {
+            switch (extraCfg) {
+                case "cacheConf":
+                    cfg.setCacheConfiguration(getCacheConfiguration());
+                    break;
+                case "clientMode":
+                    cfg.setClientMode(igniteInstanceName.equals(NODE_2));
+                case "dataStorageConf":
+                    cfg.setDataStorageConfiguration(getDataStorageConfiguration());
+                    break;
+                case "active":
+                    cfg.setClusterStateOnStart(ACTIVE);
+                    break;
+                case "activeReadOnly":
+                    cfg.setClusterStateOnStart(ACTIVE_READ_ONLY);
+                    break;
+            }
+        }
+
+        return cfg;
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()

Review Comment:
   Do we need such excessive configuration?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3788207189


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,735 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * {@link AutoActivationPluginProvider} test

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3570375822


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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");
+        }

Review 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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3570411961


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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())) {

Review 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?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3758336046


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        if (cluster.state() == ClusterState.ACTIVE || cluster.state() == ClusterState.ACTIVE_READ_ONLY) {
+            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");
+        }
+    }

Review Comment:
   ```suggestion
           if (condition.apply(cluster.nodes())) {
               if (logger.isInfoEnabled())
                   logger.info("Auto activation plugin set cluster state ACTIVE - activation condition meet");
   
               cluster.state(ClusterState.ACTIVE);
               
               return;
           }
           
           if (logger.isInfoEnabled())
               logger.info("Auto activation skipped - activation condition not meet");
       }
   ```



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByConsistentID.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with specified ConsistentID values join topology.
+ */
+public class ActivateByConsistentID implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Collection of required nodes ConsistentIDs. */
+    private final Set<String> requiredNodes;
+
+    /**
+     * @param requiredNodes List of ConsistentIDs.
+     */
+    public ActivateByConsistentID(Set<String> requiredNodes) {
+        if (requiredNodes == null || requiredNodes.isEmpty())
+            throw new IllegalArgumentException("requiredNodes must be set");
+
+        this.requiredNodes = requiredNodes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new LinkedHashSet<>(requiredNodes);

Review Comment:
   ```suggestion
           Set<String> missingNodes = new HashSet<>(requiredNodes);
   ```



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";

Review Comment:
   ```suggestion
           return "Apache Software Foundation";
   ```



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new LinkedHashSet<>(requiredValues);

Review Comment:
   ```suggestion
           Set<String> missingNodes = new HashSet<>(requiredValues);
   ```



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        if (cluster.state() == ClusterState.ACTIVE || cluster.state() == ClusterState.ACTIVE_READ_ONLY) {
+            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())) {

Review Comment:
   Can we use `cluster.forServers().nodes()` here? Then we do not need client checks in both predicate classes.
   
   Or replace `IgniteException("Auto-activation-plugin supports on` with `return false`



##########
modules/auto-activation-ext/pom.xml:
##########
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+    POM file.
+-->

Review Comment:
   ```suggestion
   ```



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,735 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * {@link AutoActivationPluginProvider} test

Review Comment:
   ```suggestion
    * Tests {@link AutoActivationPluginProvider}.
   ```



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";

Review Comment:
   Same as in `org.apache.ignite.cdc.conflictresolve.CacheVersionConflictResolverPluginProvider#copyright`



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet

Review Comment:
   ```suggestion
    * Activate cluster when specified condition meet.
   ```



##########
modules/auto-activation-ext/README.md:
##########
@@ -0,0 +1,92 @@
+Apache Ignite Auto Activation Plugin
+------------------------------------
+Apache Ignite Auto Activation plugin enables cluster activation at startup, subject to configured conditions.
+
+The plugin skips cluster activation in any of next cases:
+
+- Cluster state is ACTIVE or ACTIVE_READ_ONLY
+- Cluster baseline is not empty
+- `condition` contains any client node
+
+Depending on how you use Ignite, you can an extension using one of the following methods:

Review Comment:
   > you can an extension using one
   looks like a verb is missing



##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,735 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * {@link AutoActivationPluginProvider} test
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        final IgniteConfiguration igniteConfiguration = super.getConfiguration(igniteInstanceName);
+
+        switch (igniteInstanceName) {
+            case NODE_0:
+                igniteConfiguration.setConsistentId(NODE_0);
+                break;
+
+            case NODE_1:
+                igniteConfiguration.setConsistentId(NODE_1);
+                break;
+
+            case NODE_2:
+                igniteConfiguration.setConsistentId(NODE_2);
+                break;
+
+            default: throw new IllegalArgumentException("Unknown node: " + igniteInstanceName);
+        }

Review Comment:
   Looks like switch is overhead here and we can simplify to smth like:
   ```java 
   return super.getConfiguration(igniteInstanceName)
               .setConsistentId(igniteInstanceName)
               .setClusterStateOnStart(INACTIVE)
               .setGridLogger(listeningLog);
   ```



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        if (cluster.state() == ClusterState.ACTIVE || cluster.state() == ClusterState.ACTIVE_READ_ONLY) {
+            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");
+        }
+    }

Review Comment:
   Usually it's better to use extra return instead of `else`



##########
modules/auto-activation-ext/pom.xml:
##########
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+    POM file.
+-->

Review Comment:
   Delete to fix `Ignoring multiple XML header comment!` warning for command `mvn clean install -pl :ignite-auto-activation-ext -am -Pcheckstyle -DskipTests`



##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new LinkedHashSet<>(requiredValues);

Review Comment:
   Better to use HashSet when we do not need insertion order for iteration



##########
modules/auto-activation-ext/README.md:
##########
@@ -0,0 +1,92 @@
+Apache Ignite Auto Activation Plugin
+------------------------------------
+Apache Ignite Auto Activation plugin enables cluster activation at startup, subject to configured conditions.
+
+The plugin skips cluster activation in any of next cases:
+
+- Cluster state is ACTIVE or ACTIVE_READ_ONLY
+- Cluster baseline is not empty
+- `condition` contains any client node
+
+Depending on how you use Ignite, you can an extension using one of the following methods:

Review Comment:
   > you can an extension using one
   
   looks like a verb is missing



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466741774


##########
modules/auto-activation-ext/src/test/resources/activate-by-node-attribute/ignite-server-node3.xml:
##########
@@ -0,0 +1,114 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+  <bean abstract="false" class="org.apache.ignite.configuration.IgniteConfiguration">
+
+    <!-- Настройка региона -->
+    <property name="dataStorageConfiguration">
+      <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+        <property name="defaultDataRegionConfiguration">
+          <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+            <property name="initialSize" value="#{10 * 1024 * 1024}"/>
+            <property name="maxSize" value="#{15 * 1024 * 1024}"/>
+            <property name="name"                       value="default"/>
+            <property name="persistenceEnabled"         value="true"/>
+            <property name="metricsEnabled"             value="true"/>
+            <property name="pageReplacementMode"        value="SEGMENTED_LRU"/>
+          </bean>
+        </property>
+        <property name="walSegmentSize" value="#{2 * 1024 * 1024}" />
+        <property name="walSegments" value="10" />
+      </bean>
+    </property>
+
+    <!-- Другие свойства. -->
+    <property name="consistentId" value="cell-2_node-1"/>
+    <property name="igniteInstanceName" value="cell-2_node-1"/>
+
+    <!-- Настройка кеша -->
+    <property name="cacheConfiguration">
+      <list>
+        <bean class="org.apache.ignite.configuration.CacheConfiguration">
+          <property name="cacheMode" value="PARTITIONED"/>
+          <property name="affinity">
+            <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
+              <property name="partitions" value="32"/>
+              <property name="affinityBackupFilter">
+                <bean class="org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeColocatedBackupFilter">
+                  <constructor-arg value="CELL"/>
+                </bean>
+              </property>
+            </bean>
+          </property>
+          <property name="name" value="default"/>
+          <property name="atomicityMode" value="ATOMIC"/>
+          <property name="backups" value="1"/>
+        </bean>
+      </list>
+    </property>
+
+    <!-- Конфигурация TCP Discovery SPI -->

Review Comment:
   Please, use english language for comments



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466838990


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,135 @@
+package opt.apache.ignite.activation;

Review Comment:
   add license



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3866529050


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {
+        ApplicationContext ctx = new ClassPathXmlApplicationContext("common-ignite-server-node.xml", xmlPath);
+
+        return ctx.getBean(IgniteConfiguration.class).setGridLogger(listeningLog);
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(nodesConsistentIds)
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdFirstTwoNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_0, NODE_1))
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertFalse(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdOnlyLastNode() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_2))
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodesPlusCacheConfig() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_2))
+        );
+

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3866502778


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {
+        ApplicationContext ctx = new ClassPathXmlApplicationContext("common-ignite-server-node.xml", xmlPath);
+
+        return ctx.getBean(IgniteConfiguration.class).setGridLogger(listeningLog);
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(nodesConsistentIds)
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdFirstTwoNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_0, NODE_1))
+        );
+

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3788235154


##########
modules/auto-activation-ext/README.md:
##########
@@ -0,0 +1,92 @@
+Apache Ignite Auto Activation Plugin
+------------------------------------
+Apache Ignite Auto Activation plugin enables cluster activation at startup, subject to configured conditions.
+
+The plugin skips cluster activation in any of next cases:
+
+- Cluster state is ACTIVE or ACTIVE_READ_ONLY
+- Cluster baseline is not empty
+- `condition` contains any client node
+
+Depending on how you use Ignite, you can an extension using one of the following methods:

Review Comment:
   Certainly missed it. Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3788139568


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        if (cluster.state() == ClusterState.ACTIVE || cluster.state() == ClusterState.ACTIVE_READ_ONLY) {
+            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())) {

Review Comment:
   Good suggestion! I've applied the `cluster.forServers().nodes()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3466788461


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,48 @@
+package opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** */

Review Comment:
   ```suggestion
       /** {@inheritDoc} */
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "chesnokoff (via GitHub)" <gi...@apache.org>.
chesnokoff commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3570451162


##########
modules/auto-activation-ext/src/test/resources/activate-by-consistent-ID/ignite-server-node1.xml:
##########
@@ -0,0 +1,113 @@
+<beans xmlns="http://www.springframework.org/schema/beans"

Review 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?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3524456789


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,135 @@
+package opt.apache.ignite.activation;

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3755493822


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext pc, ExtensionRegistry er) {
+        logger = pc.log(this.getClass());        
+        grid = pc.grid();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T createComponent(PluginContext pc, Class<T> type) {
+        return null;
+    }
+ 
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext cpc) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext pc) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean bln) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() {
+
+        IgniteCluster cluster = grid.cluster();
+
+        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");
+        }

Review Comment:
   Absolutely agree. Added a check for ClusterState.ACTIVE_READ_ONLY and corresponding tests



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3783371475


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/AutoActivationPluginProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+
+/**
+ * Activate cluster when specified condition meet
+ */
+public class AutoActivationPluginProvider implements PluginProvider<PluginConfiguration> {
+    /** */
+    private final IgnitePredicate<Collection<ClusterNode>> condition;
+
+    /** */
+    private IgniteLogger logger;
+
+    /** */
+    private Ignite grid;
+
+    /**
+     * @param condition Auto activation condition.
+     */
+    public AutoActivationPluginProvider(IgnitePredicate<Collection<ClusterNode>> condition) {
+        if (condition == null)
+            throw new IllegalArgumentException("Auto activation condition must be set");
+
+        this.condition = condition;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "Auto Activation Plugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new IgnitePlugin() {
+            // No-op.
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0.0-SNAPSHOT";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3787233634


##########
modules/auto-activation-ext/pom.xml:
##########
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+    POM file.
+-->

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3866505493


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()
+                .setName(DEFAULT_CACHE_NAME)
+                .setCacheMode(CacheMode.PARTITIONED)
+                .setBackups(0)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+                .setIndexedTypes(String.class, Integer.class);
+    }
+
+    /** @return IgniteConfiguration from XML. */
+    private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception {
+        ApplicationContext ctx = new ClassPathXmlApplicationContext("common-ignite-server-node.xml", xmlPath);
+
+        return ctx.getBean(IgniteConfiguration.class).setGridLogger(listeningLog);
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdAllNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(nodesConsistentIds)
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdFirstTwoNodes() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_0, NODE_1))
+        );
+
+        try (IgniteEx node0 = startGrid(getConfiguration(NODE_0).setPluginProviders(autoActivationProvider))) {
+            assertTrue(lsnrActNotMeet.check());
+            assertFalse(lsnrActMeet.check());
+            assertEquals(node0.cluster().state(), INACTIVE);
+
+            startGrid(getConfiguration(NODE_1).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrActMeet.check());
+            assertFalse(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+
+            startGrid(getConfiguration(NODE_2).setPluginProviders(autoActivationProvider));
+
+            assertTrue(lsnrAlreadyAct.check());
+            assertEquals(node0.cluster().state(), ACTIVE);
+        }
+    }
+
+    /** */
+    @Test
+    public void testSuccessfulInMemoryClusterActivationByConsistentIdOnlyLastNode() throws Exception {
+        PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider(
+                new ActivateByConsistentID(Set.of(NODE_2))
+        );
+

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3866490845


##########
modules/auto-activation-ext/src/main/java/opt/apache/ignite/activation/ActivateByNodeAttribute.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgnitePredicate;
+
+/**
+ * Activate cluster when nodes with all specified attributes values join topology.
+ */
+public class ActivateByNodeAttribute implements IgnitePredicate<Collection<ClusterNode>> {
+    /** Node's attribute name. */
+    private final String attrName;
+
+    /** Collection of values for node's attribute. */
+    private final Set<String> requiredValues;
+
+    /**
+     * @param attributeName Node's attribute name.
+     * @param requiredValues List of values for node's attribute.
+     */
+    public ActivateByNodeAttribute(String attributeName, Set<String> requiredValues) {
+        if (attributeName == null || attributeName.isBlank())
+            throw new IllegalArgumentException("attributeName must be set");
+
+        if (requiredValues == null || requiredValues.isEmpty())
+            throw new IllegalArgumentException("requiredValues must be set");
+
+        this.attrName = attributeName;
+        this.requiredValues = requiredValues;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean apply(Collection<ClusterNode> nodes) {
+        Set<String> missingNodes = new HashSet<>(requiredValues);
+
+        for (ClusterNode node : nodes) {
+            String attrVal = node.attribute(attrName);
+
+            missingNodes.remove(attrVal);
+
+            if (missingNodes.isEmpty())
+                break;
+        }
+
+        return missingNodes.isEmpty();
+    }

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28731 Create cluster auto activation plugin [ignite-extensions]

Posted by "DenisPolo (via GitHub)" <gi...@apache.org>.
DenisPolo commented on code in PR #355:
URL: https://github.com/apache/ignite-extensions/pull/355#discussion_r3888249670


##########
modules/auto-activation-ext/src/test/java/opt/apache/ignite/activation/AutoActivationTest.java:
##########
@@ -0,0 +1,737 @@
+/*
+ * 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 opt.apache.ignite.activation;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE_READ_ONLY;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests {@link AutoActivationPluginProvider}.
+ */
+public class AutoActivationTest extends GridCommonAbstractTest {
+    /** Listening test logger. */
+    private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+    /** */
+    private final LogListener lsnrAlreadyAct = LogListener
+            .matches("Auto activation skipped - cluster already activated").build();
+
+    /** */
+    private final LogListener lsnrBaseline = LogListener
+            .matches("Auto activation skipped - baseline is not empty").build();
+
+    /** */
+    private final LogListener lsnrActMeet = LogListener
+            .matches("Auto activation plugin set cluster state ACTIVE - activation condition meet").build();
+
+    /** */
+    private final LogListener lsnrActNotMeet = LogListener
+            .matches("Auto activation skipped - activation condition not meet").build();
+
+    /** */
+    private final String NODE_0 = "node_0";
+
+    /** */
+    private final String NODE_1 = "node_1";
+
+    /** */
+    private final String NODE_2 = "node_2";
+
+    /** */
+    private final String NODE_3 = "node_3";
+
+    /** */
+    private final String ATTR = "CELL";
+
+    /** */
+    private final String ATTR_VAL1 = "CELL_01";
+
+    /** */
+    private final String ATTR_VAL2 = "CELL_02";
+
+    /** */
+    private final Set<String> nodesConsistentIds = Set.of(NODE_0, NODE_1, NODE_2);
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        listeningLog.registerAllListeners(lsnrAlreadyAct, lsnrBaseline, lsnrActMeet, lsnrActNotMeet);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+
+        listeningLog.clearListeners();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+                    .setConsistentId(igniteInstanceName)
+                    .setClusterStateOnStart(INACTIVE)
+                    .setGridLogger(listeningLog);
+    }
+
+    /** @return DataStorageConfiguration. */
+    private DataStorageConfiguration getDataStorageConfiguration() {
+        return new DataStorageConfiguration()
+                .setWalSegmentSize(4 * 1024 * 1024)
+                .setWalMode(WALMode.LOG_ONLY)
+                .setCheckpointFrequency(1000)
+                .setWalCompactionEnabled(true)
+                .setDefaultDataRegionConfiguration(getDataRegionConfiguration());
+    }
+
+    /** @return DataRegionConfiguration. */
+    private DataRegionConfiguration getDataRegionConfiguration() {
+        return new DataRegionConfiguration()
+                .setPersistenceEnabled(true)
+                .setMaxSize(100L * 1024 * 1024);
+    }
+
+    /** @return CacheConfiguration. */
+    private CacheConfiguration getCacheConfiguration() {
+        return new CacheConfiguration<>()

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org