You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "luchnikovbsk (via GitHub)" <gi...@apache.org> on 2023/01/31 11:07:54 UTC

[GitHub] [ignite] luchnikovbsk opened a new pull request, #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

luchnikovbsk opened a new pull request, #10508:
URL: https://github.com/apache/ignite/pull/10508

   The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND
   
   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118636811


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(

Review Comment:
   yes, 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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1119676505


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();

Review Comment:
   Cleaning must be done after test.



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120016608


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();

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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120028321


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void walWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);

Review Comment:
   done



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void walWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        long writingRate = 0;

Review Comment:
   done



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void walWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        long writingRate = 0;
+        byte i = 0;
+        for (; i<100; i++) {
+            long[] arr = new long[64];

Review Comment:
   done



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void walWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        long writingRate = 0;
+        byte i = 0;
+        for (; i<100; i++) {
+            long[] arr = new long[64];
+            Arrays.fill(arr, i);
+
+            ignite.getOrCreateCache(DEFAULT_CACHE_NAME).put(i, arr);
+
+            writingRate =  (long)metricRegistry(ignite.name(), "io", "datastorage").getAttribute("WalWritingRate");

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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120022065


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void walWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        long writingRate = 0;
+        byte i = 0;
+        for (; i<100; i++) {
+            long[] arr = new long[64];
+            Arrays.fill(arr, i);
+
+            ignite.getOrCreateCache(DEFAULT_CACHE_NAME).put(i, arr);
+
+            writingRate =  (long)metricRegistry(ignite.name(), "io", "datastorage").getAttribute("WalWritingRate");

Review Comment:
   Empty line after this required.



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118620845


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}

Review Comment:
   done



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    /**
+     * {@inheritDoc}

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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118403418


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void afterTestsStopped() throws Exception {

Review Comment:
   this method can be removed.



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118392144


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}

Review Comment:
   This should be one line comment like in other places.



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    /**
+     * {@inheritDoc}

Review Comment:
   This should be one line comment like in other places.



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118393185


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(

Review Comment:
   Will it work without array? 
   ```
     return Arrays.asList(
               WALMode.FSYNC,
               WALMode.BACKGROUND},
               WALMode.LOG_ONLY
   ```



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1091799759


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ *
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    private static final long MULTIPLICATOR = U.MB;
+    private static final int MAX_SEGMENTS = 20;
+
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();
+        exporterSpi.setPeriod(1000);
+        exporterSpi.setExportFilter(mgrp -> mgrp.name().startsWith("io.datastorage"));
+
+        return super.getConfiguration(igniteInstanceName)
+            .setMetricExporterSpi(exporterSpi, new JmxMetricExporterSpi())
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegments(10)
+                    .setWalSegmentSize((int)(1 * MULTIPLICATOR))
+                    .setMaxWalArchiveSize(20 * MULTIPLICATOR)

Review Comment:
   Ok, MULTIPLICATOR i use for debug, this is not the final PR, this is a PR for questions.
   1. Is this a good fix?
   2. Write a test that will check the correctness of the calculation of this metric?
   The current test is a reproducer.
   



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1091799759


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ *
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    private static final long MULTIPLICATOR = U.MB;
+    private static final int MAX_SEGMENTS = 20;
+
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();
+        exporterSpi.setPeriod(1000);
+        exporterSpi.setExportFilter(mgrp -> mgrp.name().startsWith("io.datastorage"));
+
+        return super.getConfiguration(igniteInstanceName)
+            .setMetricExporterSpi(exporterSpi, new JmxMetricExporterSpi())
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegments(10)
+                    .setWalSegmentSize((int)(1 * MULTIPLICATOR))
+                    .setMaxWalArchiveSize(20 * MULTIPLICATOR)

Review Comment:
   Ok, MULTIPLICATOR i use for debug, this is not the final PR, this is a PR for questions.
   1. Is this a good fix?
   2. Write a test that will check the correctness of the calculation of this metric?
   
   The current test is a reproducer.
   



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1119675390


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.

Review Comment:
   This can be oneline comment.



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.

Review Comment:
   This can be oneline 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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1119664098


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegmentSize(1 * 1024 * 1024)

Review Comment:
   1 * 1024 * 1024 -> U.MB



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118628740


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;

Review Comment:
   In the test, the value of the metric is taken after the segment is filled.
   Decreased to 1 to speed up test execution.
   It seemed more correct to get the value  of the metric by filling the segment than by reaching some time, for example, 1 second after the start of recording.



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120021818


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void walWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);

Review Comment:
   Empty line after this required.



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void walWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        long writingRate = 0;

Review Comment:
   Empty line after this required.



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void walWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        long writingRate = 0;
+        byte i = 0;
+        for (; i<100; i++) {
+            long[] arr = new long[64];

Review Comment:
   Empty line after this required.



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118620641


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ *
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    private static final long MULTIPLICATOR = U.MB;
+    private static final int MAX_SEGMENTS = 20;
+
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();
+        exporterSpi.setPeriod(1000);
+        exporterSpi.setExportFilter(mgrp -> mgrp.name().startsWith("io.datastorage"));
+
+        return super.getConfiguration(igniteInstanceName)
+            .setMetricExporterSpi(exporterSpi, new JmxMetricExporterSpi())
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegments(10)
+                    .setWalSegmentSize((int)(1 * MULTIPLICATOR))
+                    .setMaxWalArchiveSize(20 * MULTIPLICATOR)

Review Comment:
   done



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();
+        exporterSpi.setPeriod(1000);
+        exporterSpi.setExportFilter(mgrp -> mgrp.name().startsWith("io.datastorage"));
+
+        return super.getConfiguration(igniteInstanceName)
+            .setMetricExporterSpi(exporterSpi, new JmxMetricExporterSpi())
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegments(10)
+                    .setWalSegmentSize((int)(1 * MULTIPLICATOR))
+                    .setMaxWalArchiveSize(20 * MULTIPLICATOR)
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                            .setMaxSize(20 * MULTIPLICATOR)
+                            .setCheckpointPageBufferSize(2 * MULTIPLICATOR)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+     * After the tests are completed, you can see the report with grep by ">>> REPORT"
+     */
+    @Test
+    public void WalWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        AtomicLong key = new AtomicLong();
+        List<Long> walWritingRates = new ArrayList<>();
+
+        long lastSegment = walMgr(ignite).currentSegment() + MAX_SEGMENTS;
+        long prewSegment = walMgr(ignite).currentSegment();

Review Comment:
   done 0_o



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();

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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118621643


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;

Review Comment:
   deleted it



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void afterTestsStopped() 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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118636811


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(

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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1119675036


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)

Review Comment:
   Do we really need `WalArchivePath` for this test?



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


[GitHub] [ignite] zstan commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1091788982


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ *
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    private static final long MULTIPLICATOR = U.MB;
+    private static final int MAX_SEGMENTS = 20;
+
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();
+        exporterSpi.setPeriod(1000);
+        exporterSpi.setExportFilter(mgrp -> mgrp.name().startsWith("io.datastorage"));
+
+        return super.getConfiguration(igniteInstanceName)
+            .setMetricExporterSpi(exporterSpi, new JmxMetricExporterSpi())
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegments(10)
+                    .setWalSegmentSize((int)(1 * MULTIPLICATOR))
+                    .setMaxWalArchiveSize(20 * MULTIPLICATOR)

Review Comment:
   20 * MB more clear than you proposal, i suppose.



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ *
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    private static final long MULTIPLICATOR = U.MB;
+    private static final int MAX_SEGMENTS = 20;
+
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();
+        exporterSpi.setPeriod(1000);
+        exporterSpi.setExportFilter(mgrp -> mgrp.name().startsWith("io.datastorage"));
+
+        return super.getConfiguration(igniteInstanceName)
+            .setMetricExporterSpi(exporterSpi, new JmxMetricExporterSpi())
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegments(10)
+                    .setWalSegmentSize((int)(1 * MULTIPLICATOR))
+                    .setMaxWalArchiveSize(20 * MULTIPLICATOR)

Review Comment:
   20 * MB more clear than your proposal, i suppose.



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120015437


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegmentSize(1 * 1024 * 1024)
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+     * After the tests are completed, you can see the report with grep by ">>> REPORT"
+     */
+    @Test
+    public void WalWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        AtomicLong key = new AtomicLong();
+        List<Long> walWritingRates = new ArrayList<>();
+
+        long lastSegment = walMgr(ignite).currentSegment() + 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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118393761


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;

Review Comment:
   You can use U.MB everywhere in the test without additional review.



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120019564


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void WalWritingRate() 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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1119666759


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegmentSize(1 * 1024 * 1024)
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+     * After the tests are completed, you can see the report with grep by ">>> REPORT"
+     */
+    @Test
+    public void WalWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        AtomicLong key = new AtomicLong();
+        List<Long> walWritingRates = new ArrayList<>();
+
+        long lastSegment = walMgr(ignite).currentSegment() + 1;

Review Comment:
   Let's extract `walMgr(ignite)` into variable.



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118390913


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();
+        exporterSpi.setPeriod(1000);
+        exporterSpi.setExportFilter(mgrp -> mgrp.name().startsWith("io.datastorage"));
+
+        return super.getConfiguration(igniteInstanceName)
+            .setMetricExporterSpi(exporterSpi, new JmxMetricExporterSpi())
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegments(10)
+                    .setWalSegmentSize((int)(1 * MULTIPLICATOR))
+                    .setMaxWalArchiveSize(20 * MULTIPLICATOR)
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                            .setMaxSize(20 * MULTIPLICATOR)
+                            .setCheckpointPageBufferSize(2 * MULTIPLICATOR)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+     * After the tests are completed, you can see the report with grep by ">>> REPORT"
+     */
+    @Test
+    public void WalWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        AtomicLong key = new AtomicLong();
+        List<Long> walWritingRates = new ArrayList<>();
+
+        long lastSegment = walMgr(ignite).currentSegment() + MAX_SEGMENTS;
+        long prewSegment = walMgr(ignite).currentSegment();

Review Comment:
   typo: prew -> prev



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118391385


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        log().warning(">>> REPORT: " + report.toString());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        //for debug
+        LogExporterSpi exporterSpi = new LogExporterSpi();

Review Comment:
   It seems we can remove 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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118394336


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;

Review Comment:
   Do we really need this much segements in the test? 



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118621125


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();

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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120015862


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)

Review Comment:
   no, deleted



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.

Review Comment:
   done



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.

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


[GitHub] [ignite] nizhikov merged pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov merged PR #10508:
URL: https://github.com/apache/ignite/pull/10508


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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118628740


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;

Review Comment:
   In the test, the value of the metric is taken after the segment is filled.
   Decreased to 1 to speed up test execution.
   It seemed more correct to get the value of the meter by filling the segment than by reaching some time, for example, 1 second after the start of recording.



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1118392328


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
+import org.apache.ignite.spi.metric.log.LogExporterSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ * After the tests are completed, you can see the report with grep by ">>> REPORT"
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object[]> parameters() {
+        return Arrays.asList(
+            new Object[] {WALMode.FSYNC},
+            new Object[] {WALMode.BACKGROUND},
+            new Object[] {WALMode.LOG_ONLY}
+        );
+    }
+
+    /**
+     * MULTIPLICATOR.
+     */
+    private static final long MULTIPLICATOR = U.MB;
+
+    /**
+     * Тumber of segments.
+     */
+    private static final int MAX_SEGMENTS = 20;
+
+    /**
+     * Small report for debug.
+     */
+    private static final Map<String, List<Long>> report = new HashMap<>();

Review Comment:
   It seems this can be removed.



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1119664434


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))

Review Comment:
   This can be removed and replaced with `ignite.getOrCreateCache`



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1119674680


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegmentSize(1 * 1024 * 1024)
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+     * After the tests are completed, you can see the report with grep by ">>> REPORT"
+     */
+    @Test
+    public void WalWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        AtomicLong key = new AtomicLong();
+        List<Long> walWritingRates = new ArrayList<>();
+
+        long lastSegment = walMgr(ignite).currentSegment() + 1;

Review Comment:
   It seems we don't need to care about segments here.
   Le'ts just do the following:
   
   ```
   long k = 0;
   for (; k<100; k++) {
       long[] arr = new long[64];
       Arrays.fill(arr, k);
   
       ignite.getOrCreateCache(DEFAULT_CACHE_NAME).put(key, arr);
   
       Long writingRate =  metricRegistry(ignite.name(), "io", "datastorage").getAttribute("WalWritingRate");
       if (writingRate != null && writingRate > 0)
           break;
   }
   
   assertTrue(k < 100);
   ```



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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1119675942


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).

Review Comment:
   Test checks that `WalWritingRate` metric updated in all WAL modes.



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120013445


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegmentSize(1 * 1024 * 1024)

Review Comment:
   done



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))

Review Comment:
   done



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /**
+     * WALMode.
+     */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /**
+     * WALMode values.
+     */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME))
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalArchivePath(DFLT_WAL_PATH)
+                    .setWalSegmentSize(1 * 1024 * 1024)
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).
+     * After the tests are completed, you can see the report with grep by ">>> REPORT"
+     */
+    @Test
+    public void WalWritingRate() throws Exception {
+        IgniteEx ignite = startGrid(0);
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        AtomicLong key = new AtomicLong();
+        List<Long> walWritingRates = new ArrayList<>();
+
+        long lastSegment = walMgr(ignite).currentSegment() + 1;

Review Comment:
   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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120015509


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterState;
+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.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+ */
+@RunWith(Parameterized.class)
+public class IoDatastorageMetricsTest extends GridCommonAbstractTest {
+
+    /** WALMode. */
+    @Parameterized.Parameter
+    public WALMode walMode;
+
+    /** WALMode values. */
+    @Parameterized.Parameters(name = "walMode={0}")
+    public static Collection<Object> parameters() {
+        return Arrays.asList(
+            WALMode.FSYNC,
+            WALMode.BACKGROUND,
+            WALMode.LOG_ONLY
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration()
+                    .setMetricsEnabled(true)
+                    .setWalSegmentSize((int)(U.MB))
+                    .setWalMode(walMode)
+                    .setDefaultDataRegionConfiguration(
+                        new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                    )
+            );
+    }
+
+    /**
+     * The test shows that the WalWritingRate metric is not calculated when walMode in all modes.
+     */
+    @Test
+    public void WalWritingRate() throws Exception {

Review Comment:
   Please, rename `WalWritingRate` to `testWalWritingRate` or `walWritingRate`.



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


[GitHub] [ignite] luchnikovbsk commented on a diff in pull request #10508: IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND

Posted by "luchnikovbsk (via GitHub)" <gi...@apache.org>.
luchnikovbsk commented on code in PR #10508:
URL: https://github.com/apache/ignite/pull/10508#discussion_r1120016322


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+import javax.management.DynamicMBean;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND).

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