ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject ignite git commit: IGNITE-8073 Cache read metric is calculated incorrectly in atomic cache.
Date Wed, 01 Aug 2018 14:27:32 GMT
Repository: ignite
Updated Branches:
  refs/heads/master f1ecbbc87 -> 251c91bf4


IGNITE-8073 Cache read metric is calculated incorrectly in atomic cache.

Signed-off-by: Anton Vinogradov <av@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/251c91bf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/251c91bf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/251c91bf

Branch: refs/heads/master
Commit: 251c91bf45bf53652e7f837751fd138134a18b51
Parents: f1ecbbc
Author: voipp <alkuznetsov.sb@gmail.com>
Authored: Wed Aug 1 17:27:22 2018 +0300
Committer: Anton Vinogradov <av@apache.org>
Committed: Wed Aug 1 17:27:22 2018 +0300

----------------------------------------------------------------------
 .../distributed/near/GridNearGetFuture.java     |  2 +-
 .../GridCacheNearAtomicMetricsSelfTest.java     | 36 ++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/251c91bf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index e530750..a101e7f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -498,7 +498,7 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
                         return saved;
                     }
 
-                    if (cctx.statisticsEnabled() && !skipVals && !affNode.isLocal())
+                    if (cctx.statisticsEnabled() && !skipVals && !affNode.isLocal()
&& !isNear)
                         cache().metrics0().onRead(false);
 
                     LinkedHashMap<KeyCacheObject, Boolean> keys = mapped.get(affNode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/251c91bf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearAtomicMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearAtomicMetricsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearAtomicMetricsSelfTest.java
index 70cebff..4d82c71 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearAtomicMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearAtomicMetricsSelfTest.java
@@ -17,8 +17,11 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
+import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 
 /**
  * Atomic cache metrics test.
@@ -32,4 +35,37 @@ public class GridCacheNearAtomicMetricsSelfTest extends GridCacheNearMetricsSelf
 
         return ccfg;
     }
+
+    /**
+     * Checks that enabled near cache does not affect metrics.
+     */
+    public void testNearCachePutRemoveGetMetrics() {
+        IgniteEx initiator = grid(0);
+
+        IgniteCache<Integer, Integer> cache0 = initiator.cache(DEFAULT_CACHE_NAME);
+
+        for (int i = 0; ; i++) {
+            if (!initiator.affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(initiator.cluster().localNode(),
i)) {
+                cache0.put(i, i);
+
+                GridCacheEntryEx nearEntry = near(cache0).peekEx(i);
+
+                assertTrue("Near cache doesn't contain the key", nearEntry.hasValue());
+
+                cache0.remove(i);
+
+                nearEntry = near(cache0).peekEx(i);
+
+                assertFalse("Near cache contains key which was deleted", nearEntry.hasValue());
+
+                cache0.get(i);
+
+                assertEquals(1, cache0.localMetrics().getCachePuts());
+                assertEquals(1, cache0.localMetrics().getCacheRemovals());
+                assertEquals(1, cache0.localMetrics().getCacheGets());
+
+                break;
+            }
+        }
+    }
 }


Mime
View raw message