You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/03/23 23:12:41 UTC

[GitHub] [ignite] ololo3000 opened a new pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

ololo3000 opened a new pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [ignite] anton-vinogradov closed pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

Posted by GitBox <gi...@apache.org>.
anton-vinogradov closed pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [ignite] nizhikov commented on issue #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

Posted by GitBox <gi...@apache.org>.
nizhikov commented on issue #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561#issuecomment-605829706
 
 
   Metrics naming makes sense.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [ignite] ololo3000 opened a new pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

Posted by GitBox <gi...@apache.org>.
ololo3000 opened a new pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [ignite] anton-vinogradov commented on issue #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on issue #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561#issuecomment-603780659
 
 
   > @anton-vinogradov , Hi.
   > 
   > Can the new metric be placed at PME registry wihtout creating a new registry?
   > 
   > i.e. `pme.ClusterRebalanced` instead of `rebalance.ClusterRebalanced`
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [ignite] NSAmelchev commented on a change in pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

Posted by GitBox <gi...@apache.org>.
NSAmelchev commented on a change in pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561#discussion_r397076423
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterRebalancedMetricTest.java
 ##########
 @@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.discovery;
+
+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.internal.IgniteEx;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
+import org.apache.ignite.internal.processors.metric.GridMetricManager;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.spi.metric.BooleanMetric;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.internal.processors.metric.GridMetricManager.CLUSTER_REBALANCED;
+import static org.apache.ignite.internal.processors.metric.GridMetricManager.REBALANCE_METRICS;
+
+/**
+ * Tests {@link GridMetricManager#CLUSTER_REBALANCED} metric.
+ */
+public class ClusterRebalancedMetricTest extends GridCommonAbstractTest {
+    /** Test cache name. */
+    private static final String TEST_CACHE = "TEST_CACHE";
+
+    /**
+     * @param idx Index of the node to be started.
+     * @param persistenceEnabled Whether node native persistence is enabled.
+     */
+    protected IgniteConfiguration getConfiguration(int idx, boolean persistenceEnabled) throws Exception {
+        DataRegionConfiguration drCfg = new DataRegionConfiguration()
+            .setPersistenceEnabled(persistenceEnabled);
+
+        DataStorageConfiguration dsCfg = new DataStorageConfiguration()
+            .setDefaultDataRegionConfiguration(drCfg);
+
+        return getConfiguration(getTestIgniteInstanceName(idx))
+            .setDataStorageConfiguration(dsCfg);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("rawtypes")
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();
+
+        CacheConfiguration cCfg = new CacheConfiguration(TEST_CACHE)
+            .setBackups(2)
+            .setCacheMode(PARTITIONED)
+            .setAtomicityMode(TRANSACTIONAL);
+
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(cCfg)
+            .setCommunicationSpi(commSpi)
+            .setClusterStateOnStart(INACTIVE);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+    }
+
+    /**
+     * Tests {@link GridMetricManager#CLUSTER_REBALANCED} metric in case of in-memory cluster.
+     */
+    @Test
+    public void testInMemoryClusterRebalancedMetric() throws Exception {
+        checkClusterRebalancedMetric(false);
+    }
+
+    /**
+     * Tests {@link GridMetricManager#CLUSTER_REBALANCED} metric in case of cluster with native persistence enabled.
+     */
+    @Test
+    public void testPersistenceClusterRebalancedMetric() throws Exception {
+        checkClusterRebalancedMetric(true);
+    }
+
+    /**
+     * @param persistenceEnabled Whether native persistence is enabled.
+     */
+    public void checkClusterRebalancedMetric(boolean persistenceEnabled) throws Exception {
+        IgniteEx ignite = startGrid(0, persistenceEnabled);
+
+        startClientGrid(1, persistenceEnabled);
+
+        assertClusterRebalancedMetricOnAllNodes(false);
+
+        ignite.cluster().state(ACTIVE);
+
+        awaitPmeAndAssertRebalancedMetricOnAllNodes(true);
+
+        ignite.cache(TEST_CACHE).put("key", "val");
+
+        startClientGrid(2, persistenceEnabled);
+
+        awaitPmeAndAssertRebalancedMetricOnAllNodes(true);
+
+        TestRecordingCommunicationSpi spi = startGridWithRebalanceBlocked(3, persistenceEnabled);
+
+        if (persistenceEnabled) {
+            awaitPartitionMapExchange(true, true, null, false);
+
+            assertClusterRebalancedMetricOnAllNodes(true);
+
+            ignite.cluster().setBaselineTopology(ignite.cluster().forServers().nodes());
+        }
+
+        spi.waitForBlocked();
+
+        assertClusterRebalancedMetricOnAllNodes(false);
+
+        spi.stopBlock();
+
+        awaitPmeAndAssertRebalancedMetricOnAllNodes(true);
+    }
+
+    /**
+     * @param exp Expected value of {@link GridMetricManager#CLUSTER_REBALANCED} metric.
+     */
+    private void awaitPmeAndAssertRebalancedMetricOnAllNodes(boolean exp) throws Exception {
+        awaitPartitionMapExchange(true, true, null, true);
+
+        assertClusterRebalancedMetricOnAllNodes(exp);
+    }
+
+    /**
+     * Checks that {@link GridMetricManager#CLUSTER_REBALANCED} metric is set to {@code exp} on all cluster nodes.
+     */
+    private void assertClusterRebalancedMetricOnAllNodes(boolean exp) {
+        G.allGrids().stream().allMatch(ignite -> {
 
 Review comment:
   `allMatch` result ignored.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [ignite] anton-vinogradov merged pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

Posted by GitBox <gi...@apache.org>.
anton-vinogradov merged pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [ignite] NSAmelchev commented on issue #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

Posted by GitBox <gi...@apache.org>.
NSAmelchev commented on issue #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561#issuecomment-603729595
 
 
   @anton-vinogradov , Hi.
   
   Can the new metric be placed at PME registry wihtout creating a new registry?
   
   i.e. `pme.ClusterRebalanced` instead of `rebalance.ClusterRebalanced`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [ignite] ololo3000 commented on a change in pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.

Posted by GitBox <gi...@apache.org>.
ololo3000 commented on a change in pull request #7561: IGNITE-12788 Adds cluster fully rebalanced state metric.
URL: https://github.com/apache/ignite/pull/7561#discussion_r397096754
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterRebalancedMetricTest.java
 ##########
 @@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.discovery;
+
+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.internal.IgniteEx;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
+import org.apache.ignite.internal.processors.metric.GridMetricManager;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.spi.metric.BooleanMetric;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
+import static org.apache.ignite.cluster.ClusterState.INACTIVE;
+import static org.apache.ignite.internal.processors.metric.GridMetricManager.CLUSTER_REBALANCED;
+import static org.apache.ignite.internal.processors.metric.GridMetricManager.REBALANCE_METRICS;
+
+/**
+ * Tests {@link GridMetricManager#CLUSTER_REBALANCED} metric.
+ */
+public class ClusterRebalancedMetricTest extends GridCommonAbstractTest {
+    /** Test cache name. */
+    private static final String TEST_CACHE = "TEST_CACHE";
+
+    /**
+     * @param idx Index of the node to be started.
+     * @param persistenceEnabled Whether node native persistence is enabled.
+     */
+    protected IgniteConfiguration getConfiguration(int idx, boolean persistenceEnabled) throws Exception {
+        DataRegionConfiguration drCfg = new DataRegionConfiguration()
+            .setPersistenceEnabled(persistenceEnabled);
+
+        DataStorageConfiguration dsCfg = new DataStorageConfiguration()
+            .setDefaultDataRegionConfiguration(drCfg);
+
+        return getConfiguration(getTestIgniteInstanceName(idx))
+            .setDataStorageConfiguration(dsCfg);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("rawtypes")
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();
+
+        CacheConfiguration cCfg = new CacheConfiguration(TEST_CACHE)
+            .setBackups(2)
+            .setCacheMode(PARTITIONED)
+            .setAtomicityMode(TRANSACTIONAL);
+
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(cCfg)
+            .setCommunicationSpi(commSpi)
+            .setClusterStateOnStart(INACTIVE);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids(true);
+
+        cleanPersistenceDir();
+    }
+
+    /**
+     * Tests {@link GridMetricManager#CLUSTER_REBALANCED} metric in case of in-memory cluster.
+     */
+    @Test
+    public void testInMemoryClusterRebalancedMetric() throws Exception {
+        checkClusterRebalancedMetric(false);
+    }
+
+    /**
+     * Tests {@link GridMetricManager#CLUSTER_REBALANCED} metric in case of cluster with native persistence enabled.
+     */
+    @Test
+    public void testPersistenceClusterRebalancedMetric() throws Exception {
+        checkClusterRebalancedMetric(true);
+    }
+
+    /**
+     * @param persistenceEnabled Whether native persistence is enabled.
+     */
+    public void checkClusterRebalancedMetric(boolean persistenceEnabled) throws Exception {
+        IgniteEx ignite = startGrid(0, persistenceEnabled);
+
+        startClientGrid(1, persistenceEnabled);
+
+        assertClusterRebalancedMetricOnAllNodes(false);
+
+        ignite.cluster().state(ACTIVE);
+
+        awaitPmeAndAssertRebalancedMetricOnAllNodes(true);
+
+        ignite.cache(TEST_CACHE).put("key", "val");
+
+        startClientGrid(2, persistenceEnabled);
+
+        awaitPmeAndAssertRebalancedMetricOnAllNodes(true);
+
+        TestRecordingCommunicationSpi spi = startGridWithRebalanceBlocked(3, persistenceEnabled);
+
+        if (persistenceEnabled) {
+            awaitPartitionMapExchange(true, true, null, false);
+
+            assertClusterRebalancedMetricOnAllNodes(true);
+
+            ignite.cluster().setBaselineTopology(ignite.cluster().forServers().nodes());
+        }
+
+        spi.waitForBlocked();
+
+        assertClusterRebalancedMetricOnAllNodes(false);
+
+        spi.stopBlock();
+
+        awaitPmeAndAssertRebalancedMetricOnAllNodes(true);
+    }
+
+    /**
+     * @param exp Expected value of {@link GridMetricManager#CLUSTER_REBALANCED} metric.
+     */
+    private void awaitPmeAndAssertRebalancedMetricOnAllNodes(boolean exp) throws Exception {
+        awaitPartitionMapExchange(true, true, null, true);
+
+        assertClusterRebalancedMetricOnAllNodes(exp);
+    }
+
+    /**
+     * Checks that {@link GridMetricManager#CLUSTER_REBALANCED} metric is set to {@code exp} on all cluster nodes.
+     */
+    private void assertClusterRebalancedMetricOnAllNodes(boolean exp) {
+        G.allGrids().stream().allMatch(ignite -> {
 
 Review comment:
   Thanks. 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services