zstan commented on code in PR #12954:
URL: https://github.com/apache/ignite/pull/12954#discussion_r3007659927


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java:
##########
@@ -338,6 +344,13 @@ private CacheStore cacheStoreWrapper(GridKernalContext ctx,
                 throw new IgniteCheckedException(new CacheLoaderException(e));
             }
             finally {
+                if (perfStatEnabled)

Review Comment:
   seems we can reduce additional code amount and implement it as:
   GridCacheAdapter#writeStatistics, wdyt ?



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java:
##########


Review Comment:
   no need a context here, just pass lambda with 2 params: OperationType op, 
long start.



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/performancestatistics/PerformanceStatisticsCacheStoreTest.java:
##########
@@ -0,0 +1,227 @@
+/*
+ * 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.performancestatistics;
+
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import javax.cache.Cache;
+import javax.cache.configuration.FactoryBuilder;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.testframework.junits.GridAbstractTest;
+import org.jetbrains.annotations.Nullable;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_DELETE;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_DELETE_ALL;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_LOAD;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_LOAD_ALL;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_LOAD_CACHE;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_WRITE;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_WRITE_ALL;
+import static org.junit.runners.Parameterized.Parameter;
+import static org.junit.runners.Parameterized.Parameters;
+
+/** Tests performance statistics for cache store operations. */
+@RunWith(Parameterized.class)
+public class PerformanceStatisticsCacheStoreTest extends 
AbstractPerformanceStatisticsTest {
+    /** Cache store operation types. */
+    private static final Set<OperationType> CACHE_STORE_OPS = EnumSet.of(
+        CACHE_LOAD,
+        CACHE_LOAD_ALL,
+        CACHE_LOAD_CACHE,
+        CACHE_WRITE,
+        CACHE_WRITE_ALL,
+        CACHE_DELETE,
+        CACHE_DELETE_ALL
+    );
+
+    /** Ignite. */
+    private IgniteEx ignite;
+
+    /** Test cache. */
+    private IgniteCache<Integer, Integer> cache;
+
+    /** Write-behind mode flag. */
+    @Parameter
+    public boolean writeBehind;
+
+    /** */
+    @Parameters(name = "writeBehind={0}")
+    public static List<Boolean> parameters() {
+        return List.of(false, true);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setCacheConfiguration(GridAbstractTest.<Integer, 
Integer>defaultCacheConfiguration()
+            .setReadThrough(true)
+            .setWriteThrough(true)
+            .setWriteBehindEnabled(writeBehind)
+            
.setCacheStoreFactory(FactoryBuilder.factoryOf(TestCacheStore.class))

Review Comment:
   ```suggestion
               
.setCacheStoreFactory(FactoryBuilder.factoryOf(MapCacheStoreStrategy.MapCacheStore.class))
   ```



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/performancestatistics/PerformanceStatisticsCacheStoreTest.java:
##########
@@ -0,0 +1,227 @@
+/*
+ * 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.performancestatistics;
+
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import javax.cache.Cache;
+import javax.cache.configuration.FactoryBuilder;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.testframework.junits.GridAbstractTest;
+import org.jetbrains.annotations.Nullable;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_DELETE;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_DELETE_ALL;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_LOAD;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_LOAD_ALL;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_LOAD_CACHE;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_WRITE;
+import static 
org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_WRITE_ALL;
+import static org.junit.runners.Parameterized.Parameter;
+import static org.junit.runners.Parameterized.Parameters;
+
+/** Tests performance statistics for cache store operations. */
+@RunWith(Parameterized.class)
+public class PerformanceStatisticsCacheStoreTest extends 
AbstractPerformanceStatisticsTest {
+    /** Cache store operation types. */
+    private static final Set<OperationType> CACHE_STORE_OPS = EnumSet.of(
+        CACHE_LOAD,
+        CACHE_LOAD_ALL,
+        CACHE_LOAD_CACHE,
+        CACHE_WRITE,
+        CACHE_WRITE_ALL,
+        CACHE_DELETE,
+        CACHE_DELETE_ALL
+    );
+
+    /** Ignite. */
+    private IgniteEx ignite;
+
+    /** Test cache. */
+    private IgniteCache<Integer, Integer> cache;
+
+    /** Write-behind mode flag. */
+    @Parameter
+    public boolean writeBehind;
+
+    /** */
+    @Parameters(name = "writeBehind={0}")
+    public static List<Boolean> parameters() {
+        return List.of(false, true);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setCacheConfiguration(GridAbstractTest.<Integer, 
Integer>defaultCacheConfiguration()
+            .setReadThrough(true)
+            .setWriteThrough(true)
+            .setWriteBehindEnabled(writeBehind)

Review Comment:
   why we need this param if no part of WriteBehind logic is tested for now ?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to