ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [36/50] [abbrv] incubator-ignite git commit: ignite-696 IgniteCache.size() should return primary key size by default
Date Fri, 10 Apr 2015 08:00:08 GMT
ignite-696 IgniteCache.size() should return primary key size by default


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

Branch: refs/heads/ignite-625-1
Commit: c6877a7cb1a76f8030ec8551f30ae473511bd6d6
Parents: a60f47d
Author: Andrey Gura <agura@gridgain.com>
Authored: Wed Apr 8 22:42:16 2015 +0300
Committer: Andrey Gura <agura@gridgain.com>
Committed: Thu Apr 9 20:49:10 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteCache.java     |  6 ++-
 .../processors/cache/GridCacheAdapter.java      | 25 +++++++-----
 .../cache/GridCacheAbstractFullApiSelfTest.java | 13 ++++---
 .../GridCacheAbstractIteratorsSelfTest.java     |  3 +-
 .../cache/GridCacheAbstractSelfTest.java        | 10 ++---
 .../cache/GridCacheClearAllSelfTest.java        |  2 +-
 .../cache/GridCacheDeploymentSelfTest.java      |  9 +++--
 .../GridCachePreloadingEvictionsSelfTest.java   | 23 +++++------
 .../cache/GridCacheSwapPreloadSelfTest.java     |  5 ++-
 .../cache/IgniteCachePeekModesAbstractTest.java | 40 ++++++++++----------
 .../GridCacheMultiNodeAbstractTest.java         | 13 ++++---
 .../dht/GridCacheDhtEntrySelfTest.java          | 12 +++---
 .../dht/GridCacheDhtPreloadUnloadSelfTest.java  |  2 +-
 .../near/GridCacheNearMultiNodeSelfTest.java    | 26 ++++++-------
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |  2 +-
 ...achePartitionedMultiNodeFullApiSelfTest.java |  6 +--
 .../near/IgniteCacheNearReadCommittedTest.java  |  4 +-
 ...CacheReplicatedPreloadLifecycleSelfTest.java |  5 ++-
 .../GridCacheReplicatedPreloadSelfTest.java     | 23 ++++++-----
 .../cache/ttl/CacheTtlAbstractSelfTest.java     | 14 +++----
 20 files changed, 131 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index 5c5bb25..959ec1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -260,7 +260,8 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
     public void localPromote(Set<? extends K> keys) throws CacheException;
 
     /**
-     * Gets the number of all entries cached across all nodes.
+     * Gets the number of all entries cached across all nodes. By default, if {@code peekModes} value isn't defined
+     * size across all primary copies of partitioned cache will be returned (for all configured storages).
      * <p>
      * NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
      *
@@ -271,7 +272,8 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
     public int size(CachePeekMode... peekModes) throws CacheException;
 
     /**
-     * Gets the number of all entries cached on this node.
+     * Gets the number of all entries cached on this node. By default, if {@code peekModes} value isn't defined
+     * size of primary copy of partitioned cache will be returned (for all configured storages).
      *
      * @param peekModes Optional peek modes. If not provided, then total cache size is returned.
      * @return Cache size on this node.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 9281976..45c449b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -626,7 +626,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
         ctx.checkSecurity(GridSecurityPermission.CACHE_READ);
 
-        PeekModes modes = parsePeekModes(peekModes);
+        PeekModes modes = parsePeekModes(peekModes, false);
 
         Collection<Iterator<Cache.Entry<K, V>>> its = new ArrayList<>();
 
@@ -687,7 +687,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
         ctx.checkSecurity(GridSecurityPermission.CACHE_READ);
 
-        PeekModes modes = parsePeekModes(peekModes);
+        PeekModes modes = parsePeekModes(peekModes, false);
 
         try {
             KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
@@ -3737,7 +3737,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
     @Override public IgniteInternalFuture<Integer> sizeAsync(CachePeekMode[] peekModes) {
         assert peekModes != null;
 
-        PeekModes modes = parsePeekModes(peekModes);
+        PeekModes modes = parsePeekModes(peekModes, true);
 
         IgniteClusterEx cluster = ctx.grid().cluster();
 
@@ -3769,7 +3769,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
     /** {@inheritDoc} */
     @SuppressWarnings("ForLoopReplaceableByForEach")
     @Override public int localSize(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        PeekModes modes = parsePeekModes(peekModes);
+        PeekModes modes = parsePeekModes(peekModes, true);
 
         int size = 0;
 
@@ -4920,15 +4920,19 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
     /**
      * @param peekModes Cache peek modes array.
+     * @param primary Defines the default behavior if affinity flags are not specified.
      * @return Peek modes flags.
      */
-    private static PeekModes parsePeekModes(CachePeekMode[] peekModes) {
+    private static PeekModes parsePeekModes(CachePeekMode[] peekModes, boolean primary) {
         PeekModes modes = new PeekModes();
 
         if (F.isEmpty(peekModes)) {
-            modes.near = true;
             modes.primary = true;
-            modes.backup = true;
+
+            if (!primary) {
+                modes.backup = true;
+                modes.near = true;
+            }
 
             modes.heap = true;
             modes.offheap = true;
@@ -4994,8 +4998,11 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
         if (!(modes.primary || modes.backup || modes.near)) {
             modes.primary = true;
-            modes.backup = true;
-            modes.near = true;
+
+            if (!primary) {
+                modes.backup = true;
+                modes.near = true;
+            }
         }
 
         assert modes.heap || modes.offheap || modes.swap;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 1238565..30c2515 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -287,7 +287,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
                 if (ctx.affinity().localNode(key, new AffinityTopologyVersion(ctx.discovery().topologyVersion())))
                     sum++;
 
-            assertEquals("Incorrect key size on cache #" + i, sum, jcache(i).localSize());
+            assertEquals("Incorrect key size on cache #" + i, sum, jcache(i).localSize(CachePeekMode.ALL));
         }
 
         for (int i = 0; i < gridCount(); i++) {
@@ -312,7 +312,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         int globalSize = globalPrimarySize * times;
 
         for (int i = 0; i < gridCount(); i++)
-            assertEquals(globalSize, jcache(i).size());
+            assertEquals(globalSize, jcache(i).size(CachePeekMode.ALL));
     }
 
     /**
@@ -3731,7 +3731,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      */
     protected void checkSize(Collection<String> keys) throws Exception {
         if (nearEnabled())
-            assertEquals(keys.size(), jcache().localSize());
+            assertEquals(keys.size(), jcache().localSize(CachePeekMode.ALL));
         else {
             for (int i = 0; i < gridCount(); i++) {
                 GridCacheContext<String, Integer> ctx = context(i);
@@ -3753,7 +3753,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
                     }
                 }
 
-                assertEquals("Incorrect size on cache #" + i, size, jcache(i).localSize());
+                assertEquals("Incorrect size on cache #" + i, size, jcache(i).localSize(CachePeekMode.ALL));
             }
         }
     }
@@ -3764,7 +3764,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      */
     protected void checkKeySize(Collection<String> keys) throws Exception {
         if (nearEnabled())
-            assertEquals("Invalid key size: " + jcache().localSize(), keys.size(), jcache().localSize());
+            assertEquals("Invalid key size: " + jcache().localSize(CachePeekMode.ALL),
+                keys.size(), jcache().localSize(CachePeekMode.ALL));
         else {
             for (int i = 0; i < gridCount(); i++) {
                 GridCacheContext<String, Integer> ctx = context(i);
@@ -3775,7 +3776,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
                     if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
                         size++;
 
-                assertEquals("Incorrect key size on cache #" + i, size, jcache(i).localSize());
+                assertEquals("Incorrect key size on cache #" + i, size, jcache(i).localSize(CachePeekMode.ALL));
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java
index 46d053b..b6cf3dd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.testframework.*;
@@ -95,7 +96,7 @@ public abstract class GridCacheAbstractIteratorsSelfTest extends GridCacheAbstra
      * @throws Exception If failed.
      */
     public void testEntrySetIterator() throws Exception {
-        assert jcache().localSize() == entryCount();
+        assert jcache().localSize(CachePeekMode.ALL) == entryCount();
 
         int cnt = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index aa0b3d4..342eb5a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -112,7 +112,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
                     final int fi = i;
 
                     assertTrue(
-                        "Cache is not empty: " + " localSize = " + jcache(fi).localSize()
+                        "Cache is not empty: " + " localSize = " + jcache(fi).localSize(CachePeekMode.ALL)
                         + ", local entries " + entrySet(jcache(fi).localEntries()),
                         GridTestUtils.waitForCondition(
                             // Preloading may happen as nodes leave, so we need to wait.
@@ -120,12 +120,12 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
                                 @Override public boolean applyx() throws IgniteCheckedException {
                                     jcache(fi).removeAll();
 
-                                    if (jcache(fi).size() > 0) {
+                                    if (jcache(fi).size(CachePeekMode.ALL) > 0) {
                                         for (Cache.Entry<String, ?> k : jcache(fi).localEntries())
                                             jcache(fi).remove(k.getKey());
                                     }
 
-                                    return jcache(fi).localSize() == 0;
+                                    return jcache(fi).localSize(CachePeekMode.ALL) == 0;
                                 }
                             },
                             getTestTimeout()));
@@ -145,7 +145,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
                         ", entrySet=" + jcache(i).localEntries() + ']');
 
                     assertEquals("Cache is not empty [idx=" + i + ", entrySet=" + jcache(i).localEntries() + ']',
-                        0, jcache(i).localSize());
+                        0, jcache(i).localSize(CachePeekMode.ALL));
 
                     break;
                 }
@@ -165,7 +165,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
         }
 
         assert jcache().unwrap(Ignite.class).transactions().tx() == null;
-        assertEquals("Cache is not empty", 0, jcache().localSize());
+        assertEquals("Cache is not empty", 0, jcache().localSize(CachePeekMode.ALL));
 
         resetStore();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java
index 353f4e3..b4d385a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java
@@ -159,7 +159,7 @@ public class GridCacheClearAllSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < GRID_CNT - 1; i++) {
             IgniteCache<Object, Object> cache = grid(i).cache(CACHE_NAME);
 
-            assertEquals("Key set [i=" + i + ']', KEY_CNT, cache.localSize());
+            assertEquals("Key set [i=" + i + ']', KEY_CNT, cache.localSize(CachePeekMode.ALL));
         }
 
         assert grid(GRID_CNT - 1).cache(CACHE_NAME_OTHER).localSize() == KEY_CNT_OTHER;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
index 7184a97..9d4298d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -247,11 +248,11 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
 
             stopGrid(GRID_NAME);
 
-            assert g1.cache(null).localSize() == 1;
-            assert g1.cache(null).localSize() == 1;
+            assert g1.cache(null).localSize(CachePeekMode.ALL) == 1;
+            assert g1.cache(null).localSize(CachePeekMode.ALL) == 1;
 
-            assert g2.cache(null).localSize() == 1;
-            assert g2.cache(null).localSize() == 1;
+            assert g2.cache(null).localSize(CachePeekMode.ALL) == 1;
+            assert g2.cache(null).localSize(CachePeekMode.ALL) == 1;
 
             startGrid(3);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
index 89646e9..b79d4d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
@@ -50,6 +50,7 @@ import static org.apache.ignite.events.EventType.*;
 public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest {
     /** */
     private static final String VALUE = createValue();
+    public static final CachePeekMode[] ALL_PEEK_MODES = new CachePeekMode[]{CachePeekMode.ALL};
 
     /** */
     private final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
@@ -111,7 +112,7 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
 
             final CountDownLatch startLatch = new CountDownLatch(1);
 
-            int oldSize = cache1.localSize();
+            int oldSize = cache1.localSize(CachePeekMode.ALL);
 
             IgniteInternalFuture fut = multithreadedAsync(
                 new Callable<Object>() {
@@ -156,7 +157,7 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
 
             checkCachesConsistency(ignite1, ignite2);
 
-            oldSize = cache1.size();
+            oldSize = cache1.size(CachePeekMode.ALL);
 
             info("Evicting on constant topology.");
 
@@ -192,8 +193,8 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
 
         assertTrue(GridTestUtils.waitForCondition(new PA() {
             @Override public boolean apply() {
-                int size1 = ignite1.cache(null).localSize();
-                return size1 != oldSize && size1 == ignite2.cache(null).localSize();
+                int size1 = ignite1.cache(null).localSize(CachePeekMode.ALL);
+                return size1 != oldSize && size1 == ignite2.cache(null).localSize(CachePeekMode.ALL);
             }
         }, getTestTimeout()));
 
@@ -223,9 +224,9 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
         GridCacheAdapter<Integer, Object> cache2 = g2.internalCache();
 
         for (int i = 0; i < 3; i++) {
-            if (cache1.size() != cache2.size()) {
-                U.warn(log, "Sizes do not match (will retry in 1000 ms) [s1=" + cache1.size() +
-                    ", s2=" + cache2.size() + ']');
+            if (cache1.size(ALL_PEEK_MODES) != cache2.size(ALL_PEEK_MODES)) {
+                U.warn(log, "Sizes do not match (will retry in 1000 ms) [s1=" + cache1.size(ALL_PEEK_MODES) +
+                    ", s2=" + cache2.size(ALL_PEEK_MODES) + ']');
 
                 U.sleep(1000);
             }
@@ -233,11 +234,11 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
                 break;
         }
 
-        info("Cache1 size: " + cache1.size());
-        info("Cache2 size: " + cache2.size());
+        info("Cache1 size: " + cache1.size(ALL_PEEK_MODES));
+        info("Cache2 size: " + cache2.size(ALL_PEEK_MODES));
 
-        assert cache1.size() == cache2.size() : "Sizes do not match [s1=" + cache1.size() +
-            ", s2=" + cache2.size() + ']';
+        assert cache1.size(ALL_PEEK_MODES) == cache2.size(ALL_PEEK_MODES) :
+            "Sizes do not match [s1=" + cache1.size(ALL_PEEK_MODES) + ", s2=" + cache2.size(ALL_PEEK_MODES) + ']';
 
         for (Integer key : cache1.keySet()) {
             Object e = cache1.localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
index 051a2a9..6176da4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
@@ -124,7 +124,7 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest {
 
             startGrid(1);
 
-            int size = grid(1).cache(null).localSize();
+            int size = grid(1).cache(null).localSize(CachePeekMode.ALL);
 
             info("New node cache size: " + size);
 
@@ -201,7 +201,8 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest {
 
             fut = null;
 
-            int size = grid(1).cache(null).localSize(CachePeekMode.ONHEAP);
+            int size = grid(1).cache(null).localSize(CachePeekMode.PRIMARY, CachePeekMode.BACKUP,
+                CachePeekMode.NEAR, CachePeekMode.ONHEAP);
 
             info("New node cache size: " + size);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
index 4418bcd..c2eb56f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
@@ -480,9 +480,9 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
                 for (Integer key : keys)
                     cache0.put(key, String.valueOf(key));
 
-                assertEquals(PUT_KEYS, cache0.localSize());
                 assertEquals(PUT_KEYS, cache0.localSize(BACKUP));
                 assertEquals(PUT_KEYS, cache0.localSize(ALL));
+                assertEquals(0, cache0.localSize());
                 assertEquals(0, cache0.localSize(PRIMARY));
                 assertEquals(0, cache0.localSize(NEAR));
 
@@ -493,7 +493,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
                     assertEquals(PUT_KEYS, cache.size(PRIMARY));
                     assertEquals(PUT_KEYS * (gridCount() - 1), cache.size(BACKUP));
                     assertEquals(PUT_KEYS * gridCount(), cache.size(PRIMARY, BACKUP));
-                    assertEquals(PUT_KEYS * gridCount(), cache.size()); // Primary + backups.
+                    assertEquals(PUT_KEYS * gridCount(), cache.size(ALL)); // Primary + backups.
                 }
             }
             else {
@@ -503,7 +503,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
                     cache0.put(key, String.valueOf(key));
 
                 if (hasNearCache()) {
-                    assertEquals(PUT_KEYS, cache0.localSize());
+                    assertEquals(0, cache0.localSize());
                     assertEquals(PUT_KEYS, cache0.localSize(ALL));
                     assertEquals(PUT_KEYS, cache0.localSize(NEAR));
 
@@ -513,7 +513,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
                         assertEquals(PUT_KEYS, cache.size(NEAR));
                         assertEquals(PUT_KEYS, cache.size(BACKUP));
                         assertEquals(PUT_KEYS * 2, cache.size(PRIMARY, BACKUP));
-                        assertEquals(PUT_KEYS * 2 + PUT_KEYS, cache.size()); // Primary + backups + near.
+                        assertEquals(PUT_KEYS * 2 + PUT_KEYS, cache.size(ALL)); // Primary + backups + near.
                     }
                 }
                 else {
@@ -527,7 +527,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
                         assertEquals(0, cache.size(NEAR));
                         assertEquals(PUT_KEYS, cache.size(BACKUP));
                         assertEquals(PUT_KEYS * 2, cache.size(PRIMARY, BACKUP));
-                        assertEquals(PUT_KEYS * 2, cache.size()); // Primary + backups.
+                        assertEquals(PUT_KEYS * 2, cache.size(ALL)); // Primary + backups.
                     }
                 }
 
@@ -569,15 +569,15 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
             checkPrimarySize(PUT_KEYS - 1);
 
             if (cacheMode() == REPLICATED) {
-                assertEquals(PUT_KEYS - 1, cache0.localSize());
+                assertEquals(PUT_KEYS - 1, cache0.localSize(ALL));
                 assertEquals(0, cache0.localSize(PRIMARY));
                 assertEquals(PUT_KEYS - 1, cache0.localSize(BACKUP));
             }
             else {
                 if (hasNearCache())
-                    assertEquals(PUT_KEYS - 1, cache0.localSize());
+                    assertEquals(PUT_KEYS - 1, cache0.localSize(ALL));
                 else
-                    assertEquals(0, cache0.localSize());
+                    assertEquals(0, cache0.localSize(ALL));
             }
         }
         finally {
@@ -736,12 +736,12 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
 
             assertTrue(totalSwap + totalOffheap < totalKeys);
 
-            assertEquals(totalKeys, cache0.localSize());
+            assertEquals(primaryKeys.size(), cache0.localSize());
             assertEquals(totalKeys, cache0.localSize(ALL));
-            assertEquals(totalOffheap, cache0.localSize(OFFHEAP));
-            assertEquals(totalSwap, cache0.localSize(SWAP));
-            assertEquals(totalKeys - (totalOffheap + totalSwap), cache0.localSize(ONHEAP));
-            assertEquals(totalKeys, cache0.localSize(SWAP, OFFHEAP, ONHEAP));
+            assertEquals(totalOffheap, cache0.localSize(PRIMARY, BACKUP, NEAR, OFFHEAP));
+            assertEquals(totalSwap, cache0.localSize(PRIMARY, BACKUP, NEAR, SWAP));
+            assertEquals(totalKeys - (totalOffheap + totalSwap), cache0.localSize(PRIMARY, BACKUP, NEAR, ONHEAP));
+            assertEquals(totalKeys, cache0.localSize(PRIMARY, BACKUP, NEAR, SWAP, OFFHEAP, ONHEAP));
 
             assertEquals(swapKeys.get1(), (Integer)cache0.localSize(SWAP, PRIMARY));
             assertEquals(swapKeys.get2(), (Integer)cache0.localSize(SWAP, BACKUP));
@@ -752,7 +752,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
             assertEquals(swapKeys.get1() + offheapKeys.get1(), cache0.localSize(SWAP, OFFHEAP, PRIMARY));
             assertEquals(swapKeys.get2() + offheapKeys.get2(), cache0.localSize(SWAP, OFFHEAP, BACKUP));
 
-            assertEquals(totalSwap + totalOffheap, cache0.localSize(SWAP, OFFHEAP));
+            assertEquals(totalSwap + totalOffheap, cache0.localSize(PRIMARY, BACKUP, NEAR, SWAP, OFFHEAP));
 
             int globalSwapPrimary = 0;
             int globalSwapBackup = 0;
@@ -792,24 +792,24 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
             for (int i = 0; i < gridCount(); i++) {
                 IgniteCache<Integer, String> cache = jcache(i);
 
-                assertEquals(globalTotal, cache.size());
+                assertEquals(totalKeys, cache.size(PRIMARY));
                 assertEquals(globalTotal, cache.size(ALL));
-                assertEquals(globalTotal, cache.size(ONHEAP, OFFHEAP, SWAP));
+                assertEquals(globalTotal, cache.size(PRIMARY, BACKUP, NEAR, ONHEAP, OFFHEAP, SWAP));
                 assertEquals(globalTotal, cache.size(ONHEAP, OFFHEAP, SWAP, PRIMARY, BACKUP));
 
-                assertEquals(globalTotalSwap, cache.size(SWAP));
+                assertEquals(globalTotalSwap, cache.size(PRIMARY, BACKUP, NEAR, SWAP));
                 assertEquals(globalSwapPrimary, cache.size(SWAP, PRIMARY));
                 assertEquals(globalSwapBackup, cache.size(SWAP, BACKUP));
 
-                assertEquals(globalTotalOffheap, cache.size(OFFHEAP));
+                assertEquals(globalTotalOffheap, cache.size(PRIMARY, BACKUP, NEAR, OFFHEAP));
                 assertEquals(globalOffheapPrimary, cache.size(OFFHEAP, PRIMARY));
                 assertEquals(globalOffheapBackup, cache.size(OFFHEAP, BACKUP));
 
-                assertEquals(globalTotalSwap + globalTotalOffheap, cache.size(SWAP, OFFHEAP));
+                assertEquals(globalTotalSwap + globalTotalOffheap, cache.size(PRIMARY, BACKUP, NEAR, SWAP, OFFHEAP));
                 assertEquals(globalSwapPrimary + globalOffheapPrimary, cache.size(SWAP, OFFHEAP, PRIMARY));
                 assertEquals(globalSwapBackup + globalOffheapBackup, cache.size(SWAP, OFFHEAP, BACKUP));
 
-                assertEquals(globalTotal - (globalTotalOffheap + globalTotalSwap), cache.size(ONHEAP));
+                assertEquals(globalTotal - (globalTotalOffheap + globalTotalSwap), cache.size(PRIMARY, BACKUP, NEAR, ONHEAP));
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
index 0320476..78bff83 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.distributed;
 
 import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.util.tostring.*;
@@ -340,15 +341,15 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
         cache2.put(2, "val2");
         cache3.put(3, "val3");
 
-        assertEquals(3, cache1.localSize());
-        assertEquals(3, cache2.localSize());
-        assertEquals(3, cache3.localSize());
+        assertEquals(3, cache1.localSize(CachePeekMode.ALL));
+        assertEquals(3, cache2.localSize(CachePeekMode.ALL));
+        assertEquals(3, cache3.localSize(CachePeekMode.ALL));
 
         cache1.clear();
 
-        assertEquals(0, cache1.localSize());
-        assertEquals(0, cache2.localSize());
-        assertEquals(0, cache3.localSize());
+        assertEquals(0, cache1.localSize(CachePeekMode.ALL));
+        assertEquals(0, cache2.localSize(CachePeekMode.ALL));
+        assertEquals(0, cache3.localSize(CachePeekMode.ALL));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
index b6cff17..170ff18 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
@@ -178,10 +178,10 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest {
 
         assert !internalCache(near0).clearLocally(key);
 
-        assertEquals(1, near0.localSize());
+        assertEquals(1, near0.localSize(CachePeekMode.ALL));
         assertEquals(1, dht0.size());
 
-        assertEquals(1, near1.localSize());
+        assertEquals(1, near1.localSize(CachePeekMode.ALL));
         assertEquals(0, dht1.size());
     }
 
@@ -269,18 +269,18 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest {
 
         assert !e0.evictInternal(false, dht0.context().versions().next(), null);
 
-        assertEquals(1, near0.localSize());
+        assertEquals(1, near0.localSize(CachePeekMode.ALL));
         assertEquals(1, dht0.localSize(null));
 
-        assertEquals(1, near1.localSize());
+        assertEquals(1, near1.localSize(CachePeekMode.ALL));
         assertEquals(0, dht1.localSize(null));
 
         assert !e0.evictInternal(true, dht0.context().versions().next(), null);
 
-        assertEquals(1, near0.localSize());
+        assertEquals(1, near0.localSize(CachePeekMode.ALL));
         assertEquals(1, dht0.localSize(null));
 
-        assertEquals(1, near1.localSize());
+        assertEquals(1, near1.localSize(CachePeekMode.ALL));
         assertEquals(0, dht1.localSize(null));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
index e2fd38d..ed41d8d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
@@ -173,7 +173,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
                 IgniteCache<Integer, String> c = grid(i).cache(null);
 
                 // Nothing should be unloaded since nodes are backing up each other.
-                assertEquals(cnt, c.localSize());
+                assertEquals(cnt, c.localSize(CachePeekMode.ALL));
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index 548564a..3c6c777 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -402,8 +402,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
         assertEquals("2", localPeek(dht(primaryGrid(2)), 2));
         assertEquals("3", localPeek(dht(primaryGrid(3)), 3));
 
-        assertEquals(2, near.localSize());
-        assertEquals(2, near.localSize());
+        assertEquals(2, near.localSize(CachePeekMode.ALL));
+        assertEquals(2, near.localSize(CachePeekMode.ALL));
     }
 
     /** @throws Exception If failed. */
@@ -446,8 +446,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
 
         assertEquals("3", localPeek(dht(primaryIgnite), 3));
 
-        assertEquals(1, near.localSize());
-        assertEquals(1, near.localSize());
+        assertEquals(1, near.localSize(CachePeekMode.ALL));
+        assertEquals(1, near.localSize(CachePeekMode.ALL));
 
         assertEquals(1, dht(primaryIgnite).size());
 
@@ -485,8 +485,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
         assertEquals("2", localPeek(dht(primaryGrid(2)), 2));
         assertEquals("3", localPeek(dht(primaryGrid(3)), 3));
 
-        assertEquals(2, near.localSize());
-        assertEquals(2, near.localSize());
+        assertEquals(2, near.localSize(CachePeekMode.ALL));
+        assertEquals(2, near.localSize(CachePeekMode.ALL));
     }
 
     /**
@@ -529,8 +529,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
         assertEquals("2", localPeek(dht(primaryGrid(2)), 2));
         assertEquals("3", localPeek(dht(primaryGrid(3)), 3));
 
-        assertEquals(2, near.localSize());
-        assertEquals(2, near.localSize());
+        assertEquals(2, near.localSize(CachePeekMode.ALL));
+        assertEquals(2, near.localSize(CachePeekMode.ALL));
     }
 
     /** @throws Exception If failed. */
@@ -547,8 +547,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
         assertEquals("1", near.getAndPutIfAbsent(key, "2"));
 
         assertEquals("1", near.localPeek(key, CachePeekMode.ONHEAP));
-        assertEquals(1, near.localSize());
-        assertEquals(1, near.localSize());
+        assertEquals(1, near.localSize(CachePeekMode.ALL));
+        assertEquals(1, near.localSize(CachePeekMode.ALL));
 
         assertEquals("1", near.getAndReplace(key, "2"));
         assertEquals("2", near.localPeek(key, CachePeekMode.ONHEAP));
@@ -556,12 +556,12 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
         assertTrue(near.replace(key, "2"));
 
         assertEquals("2", near.localPeek(key, CachePeekMode.ONHEAP));
-        assertEquals(1, near.localSize());
-        assertEquals(1, near.localSize());
+        assertEquals(1, near.localSize(CachePeekMode.ALL));
+        assertEquals(1, near.localSize(CachePeekMode.ALL));
 
         assertTrue(near.remove(key, "2"));
 
-        assertEquals(0, near.localSize());
+        assertEquals(0, near.localSize(CachePeekMode.ALL));
     }
 
     /** @throws Exception If failed. */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index 0f699e7..92ae07a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -174,7 +174,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
 
         checkSize(map.keySet());
 
-        assertEquals(10, nearCache.localSize());
+        assertEquals(10, nearCache.localSize(CachePeekMode.ALL));
 
         int fullCacheSize = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index 2258b86..caacc2b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -321,15 +321,15 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         assertEquals(Integer.valueOf(1), cache2.get(keys.get(1)));
 
         assertEquals(0, cache0.localSize(NEAR));
-        assertEquals(5, cache0.localSize() - cache0.localSize(NEAR));
+        assertEquals(5, cache0.localSize(CachePeekMode.ALL) - cache0.localSize(NEAR));
 
         IgniteCache<String, Integer> cache1 = jcache(1);
 
         assertEquals(0, cache1.localSize(NEAR));
-        assertEquals(5, cache1.localSize() - cache1.localSize(NEAR));
+        assertEquals(5, cache1.localSize(CachePeekMode.ALL) - cache1.localSize(NEAR));
 
         assertEquals(nearEnabled() ? 2 : 0, cache2.localSize(NEAR));
-        assertEquals(0, cache2.localSize() - cache2.localSize(NEAR));
+        assertEquals(0, cache2.localSize(CachePeekMode.ALL) - cache2.localSize(NEAR));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
index 254cf09..0478cfc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
@@ -57,7 +57,7 @@ public class IgniteCacheNearReadCommittedTest extends GridCacheAbstractSelfTest
 
         cache.put(key, key);
 
-        assertEquals(1, cache.localSize());
+        assertEquals(1, cache.localSize(CachePeekMode.ALL));
 
         try (Transaction tx = ignite(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
             assertEquals(key, cache.get(key));
@@ -67,6 +67,6 @@ public class IgniteCacheNearReadCommittedTest extends GridCacheAbstractSelfTest
 
         ignite(1).cache(null).remove(key); // Remove from primary node.
 
-        assertEquals(0, cache.localSize());
+        assertEquals(0, cache.localSize(CachePeekMode.ALL));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
index e6c5517..4e6e08c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.distributed.replicated.preloader;
 
 import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
@@ -151,8 +152,8 @@ public class GridCacheReplicatedPreloadLifecycleSelfTest extends GridCachePreloa
                 IgniteCache<String, MyValue> c1 = grid(j).cache("one");
                 IgniteCache<String, MyValue> c2 = grid(j).cache("two");
 
-                int size1 = c1.localSize();
-                int size2 = c2.localSize();
+                int size1 = c1.localSize(CachePeekMode.ALL);
+                int size2 = c2.localSize(CachePeekMode.ALL);
 
                 assertEquals(" Invalid cache1 size [i=" + i + ", j=" + j + ", size=" + size1 + ']', keys.length, size1);
                 assertEquals(" Invalid cache2 size [i=" + i + ", j=" + j + ", size=" + size2 + ']', keys.length / 2, size2);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
index 9ebbebc..2bec185 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
@@ -280,7 +280,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
             IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
 
-            assertEquals(keyCnt, cache2.localSize());
+            assertEquals(keyCnt, cache2.localSize(CachePeekMode.ALL));
         }
         finally {
             stopAllGrids();
@@ -304,11 +304,12 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
             IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
 
-            int size = cache2.localSize();
+            int size = cache2.localSize(CachePeekMode.ALL);
 
             info("Size of cache2: " + size);
 
-            assert waitCacheSize(cache2, keyCnt, getTestTimeout()) : "Actual cache size: " + cache2.localSize();
+            assert waitCacheSize(cache2, keyCnt, getTestTimeout()) :
+                "Actual cache size: " + cache2.localSize(CachePeekMode.ALL);
         }
         finally {
             stopAllGrids();
@@ -331,14 +332,14 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
         long end = System.currentTimeMillis() + timeout;
 
-        while (cache.localSize() < expSize) {
+        while (cache.localSize(CachePeekMode.ALL) < expSize) {
             Thread.sleep(50);
 
             if (end - System.currentTimeMillis() <= 0)
                 break;
         }
 
-        return cache.localSize() >= expSize;
+        return cache.localSize(CachePeekMode.ALL) >= expSize;
     }
 
     /**
@@ -358,7 +359,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
             IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
 
-            assertEquals(cnt, cache2.localSize());
+            assertEquals(cnt, cache2.localSize(CachePeekMode.ALL));
         }
         finally {
             stopAllGrids();
@@ -382,7 +383,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
             IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
 
-            assertEquals(cnt, cache2.localSize());
+            assertEquals(cnt, cache2.localSize(CachePeekMode.ALL));
         }
         finally {
             stopAllGrids();
@@ -406,7 +407,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
             IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
 
-            assertEquals(cnt, cache2.localSize());
+            assertEquals(cnt, cache2.localSize(CachePeekMode.ALL));
         }
         finally {
             stopGrid(1);
@@ -450,7 +451,8 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
                 grid(0).cache(null).putAll(map);
 
             for (int gridIdx = 0; gridIdx < gridCnt; gridIdx++) {
-                assert grid(gridIdx).cache(null).localSize() == cnt : "Actual size: " + grid(gridIdx).cache(null).localSize();
+                assert grid(gridIdx).cache(null).localSize(CachePeekMode.ALL) == cnt :
+                    "Actual size: " + grid(gridIdx).cache(null).localSize(CachePeekMode.ALL);
 
                 info("Cache size is OK for grid index: " + gridIdx);
             }
@@ -467,7 +469,8 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
             stopGrid(idx);
 
-            assert waitCacheSize(lastCache, cnt, 20 * 1000) : "Actual cache size: " + lastCache.localSize();
+            assert waitCacheSize(lastCache, cnt, 20 * 1000) :
+                "Actual cache size: " + lastCache.localSize(CachePeekMode.ALL);
         }
         finally {
             stopAllGrids();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6877a7c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
index c56dfd4..3833576 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
@@ -313,20 +313,20 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
             IgniteCache<Integer, Integer> cache = jcache(i);
 
             log.info("Size [node=" + i +
-                ", heap=" + cache.localSize(ONHEAP) +
-                ", offheap=" + cache.localSize(OFFHEAP) +
-                ", swap=" + cache.localSize(SWAP) + ']');
+                ", heap=" + cache.localSize(PRIMARY, BACKUP, NEAR, ONHEAP) +
+                ", offheap=" + cache.localSize(PRIMARY, BACKUP, NEAR, OFFHEAP) +
+                ", swap=" + cache.localSize(PRIMARY, BACKUP, NEAR, SWAP) + ']');
 
             if (memoryMode() == CacheMemoryMode.OFFHEAP_TIERED) {
-                assertEquals("Unexpected size, node: " + i, 0, cache.localSize(ONHEAP));
-                assertEquals("Unexpected size, node: " + i, size, cache.localSize(OFFHEAP));
+                assertEquals("Unexpected size, node: " + i, 0, cache.localSize(PRIMARY, BACKUP, NEAR, ONHEAP));
+                assertEquals("Unexpected size, node: " + i, size, cache.localSize(PRIMARY, BACKUP, NEAR, OFFHEAP));
             }
             else {
                 assertEquals("Unexpected size, node: " + i, size > MAX_CACHE_SIZE ? MAX_CACHE_SIZE : size,
-                    cache.localSize(ONHEAP));
+                    cache.localSize(PRIMARY, BACKUP, NEAR, ONHEAP));
 
                 assertEquals("Unexpected size, node: " + i,
-                    size > MAX_CACHE_SIZE ? size - MAX_CACHE_SIZE : 0, cache.localSize(OFFHEAP));
+                    size > MAX_CACHE_SIZE ? size - MAX_CACHE_SIZE : 0, cache.localSize(PRIMARY, BACKUP, NEAR, OFFHEAP));
             }
 
             for (int key = 0; key < size; key++)


Mime
View raw message