Repository: ignite Updated Branches: refs/heads/master efd299f40 -> dc32104a8
IGNITE-5492: Fixed LOCAL cache metrics. This closes #2133. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dc32104a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dc32104a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dc32104a Branch: refs/heads/master Commit: dc32104a8c191988ea4ede0563b84186dbad7db6 Parents: efd299f Author: Roman Shtykh <[email protected]> Authored: Fri Jun 16 15:05:40 2017 +0300 Committer: devozerov <[email protected]> Committed: Fri Jun 16 15:05:40 2017 +0300 ---------------------------------------------------------------------- .../local/atomic/GridLocalAtomicCache.java | 13 ++---- .../cache/GridCacheAbstractMetricsSelfTest.java | 2 +- ...LocalAtomicMetricsNoReadThroughSelfTest.java | 48 ++++++++++++++++++++ .../IgniteCacheMetricsSelfTestSuite.java | 4 +- 4 files changed, 57 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/dc32104a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java index 384cd41..234efcc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java @@ -301,8 +301,7 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> { final K key, String taskName, boolean deserializeBinary, - boolean needVer) throws IgniteCheckedException - { + boolean needVer) throws IgniteCheckedException { Map<K, V> m = getAllInternal(Collections.singleton(key), ctx.readThrough(), taskName, @@ -509,12 +508,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> { success = false; } } - else { - if (!storeEnabled && configuration().isStatisticsEnabled() && !skipVals) - metrics0().onRead(false); - - success = false; - } break; // While. } @@ -530,6 +523,10 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> { break; } } + if (!success) { + if (!storeEnabled && configuration().isStatisticsEnabled() && !skipVals) + metrics0().onRead(false); + } } if (success || !storeEnabled) http://git-wip-us.apache.org/repos/asf/ignite/blob/dc32104a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java index b130ad9..2e81b96 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java @@ -915,4 +915,4 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract assertEquals(0, entry.expireTime()); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/dc32104a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalAtomicMetricsNoReadThroughSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalAtomicMetricsNoReadThroughSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalAtomicMetricsNoReadThroughSelfTest.java new file mode 100644 index 0000000..76f0842 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalAtomicMetricsNoReadThroughSelfTest.java @@ -0,0 +1,48 @@ +/* + * 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.local; + +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.internal.processors.cache.GridCacheAbstractMetricsSelfTest; + +import static org.apache.ignite.cache.CacheMode.LOCAL; + +/** + * Local cache metrics test in ATOMIC mode without readthrough. + */ +public class GridCacheLocalAtomicMetricsNoReadThroughSelfTest extends GridCacheAbstractMetricsSelfTest { + /** */ + private static final int GRID_CNT = 1; + + /** {@inheritDoc} */ + @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { + CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName); + + cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); + cfg.setCacheMode(LOCAL); + cfg.setReadThrough(false); + + return cfg; + } + + /** {@inheritDoc} */ + @Override protected int gridCount() { + return GRID_CNT; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/dc32104a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java index ebcf1df..b2ee8b5 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java @@ -30,6 +30,7 @@ import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCa import org.apache.ignite.internal.processors.cache.local.GridCacheAtomicLocalMetricsNoStoreSelfTest; import org.apache.ignite.internal.processors.cache.local.GridCacheAtomicLocalMetricsSelfTest; import org.apache.ignite.internal.processors.cache.local.GridCacheAtomicLocalTckMetricsSelfTestImpl; +import org.apache.ignite.internal.processors.cache.local.GridCacheLocalAtomicMetricsNoReadThroughSelfTest; import org.apache.ignite.internal.processors.cache.local.GridCacheLocalMetricsSelfTest; /** @@ -44,6 +45,7 @@ public class IgniteCacheMetricsSelfTestSuite extends TestSuite { TestSuite suite = new TestSuite("Cache Metrics Test Suite"); suite.addTestSuite(GridCacheLocalMetricsSelfTest.class); + suite.addTestSuite(GridCacheLocalAtomicMetricsNoReadThroughSelfTest.class); suite.addTestSuite(GridCacheNearMetricsSelfTest.class); suite.addTestSuite(GridCacheReplicatedMetricsSelfTest.class); suite.addTestSuite(GridCachePartitionedMetricsSelfTest.class); @@ -63,4 +65,4 @@ public class IgniteCacheMetricsSelfTestSuite extends TestSuite { return suite; } -} \ No newline at end of file +}
