# ignite-57

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

Branch: refs/heads/ignite-sql-tests
Commit: 4078998c9f621c7e8add815eb7ca153c754b9268
Parents: ac579f8
Author: sboikov <semen.boi...@inria.fr>
Authored: Thu Feb 5 23:37:55 2015 +0300
Committer: sboikov <semen.boi...@inria.fr>
Committed: Thu Feb 5 23:37:55 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |  31 ++-
 .../internal/util/offheap/GridOffHeapMap.java   |   7 +
 .../util/offheap/unsafe/GridUnsafeMap.java      |  12 +-
 .../IgniteOptimizedObjectInputStream.java       |   2 +
 .../cache/IgniteCacheSizeAbstractTest.java      | 248 ++++++++++++++++++-
 .../offheap/GridOffHeapMapAbstractSelfTest.java |  52 ++--
 6 files changed, 301 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4078998c/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 0a24bb6..af4f482 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
@@ -4185,21 +4185,30 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
 
         int size = 0;
 
-        if (heap) {
-            if (near)
-                size += nearSize();
+        if (ctx.isLocal()) {
+            primary = true;
+            backup = true;
 
-            GridCacheAdapter cache = ctx.isNear() ? ctx.near().dht() : 
ctx.cache();
+            if (heap)
+                size += size();
+        }
+        else {
+            if (heap) {
+                if (near)
+                    size += nearSize();
 
-            if (!(primary && backup)) {
-                if (primary)
-                    size += cache.primarySize();
+                GridCacheAdapter cache = ctx.isNear() ? ctx.near().dht() : 
ctx.cache();
 
-                if (backup)
-                    size += (cache.size() - cache.primarySize());
+                if (!(primary && backup)) {
+                    if (primary)
+                        size += cache.primarySize();
+
+                    if (backup)
+                        size += (cache.size() - cache.primarySize());
+                }
+                else
+                    size += cache.size();
             }
-            else
-                size += cache.size();
         }
 
         // Swap and offheap are disabled for near cache.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4078998c/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
index 9f4e4b4..d10aa22 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
@@ -129,6 +129,13 @@ public interface GridOffHeapMap<K> {
      *
      * @return Number of elements in the map.
      */
+    public long totalSize();
+
+    /**
+     * Gets number of elements in the map.
+     *
+     * @return Number of elements in the map.
+     */
     public long size();
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4078998c/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
index 229f4f2..dc742c7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
@@ -329,11 +329,21 @@ public class GridUnsafeMap<K> implements 
GridOffHeapMap<K> {
     }
 
     /** {@inheritDoc} */
-    @Override public long size() {
+    @Override public long totalSize() {
         return totalCnt.sum();
     }
 
     /** {@inheritDoc} */
+    @Override public long size() {
+        long size = 0;
+
+        for (int i = 0; i < segs.length; i++)
+            size += segs[i].count();
+
+        return size;
+    }
+
+    /** {@inheritDoc} */
     @Override public long memorySize() {
         return mem.totalSize();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4078998c/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectInputStream.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectInputStream.java
 
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectInputStream.java
index 690bdd6..d596af3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectInputStream.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectInputStream.java
@@ -110,6 +110,8 @@ class IgniteOptimizedObjectInputStream extends 
ObjectInputStream {
     /** {@inheritDoc} */
     @Override public void close() throws IOException {
         reset();
+
+        clsLdr = null;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4078998c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSizeAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSizeAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSizeAbstractTest.java
index 35c3c86..dbc2e9a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSizeAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSizeAbstractTest.java
@@ -23,6 +23,9 @@ import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cache.eviction.fifo.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.*;
 import org.apache.ignite.spi.swapspace.file.*;
 
 import java.util.*;
@@ -79,19 +82,7 @@ public abstract class IgniteCacheSizeAbstractTest extends 
IgniteCacheAbstractTes
      * @throws Exception If failed.
      */
     public void testSize() throws Exception {
-        for (int i = 0; i < gridCount(); i++) {
-            IgniteCache<Integer, String> cache = jcache(i);
-
-            assertEquals(0, cache.localSize());
-
-            assertEquals(0, cache.size());
-
-            for (CachePeekMode peekMode : CachePeekMode.values()) {
-                assertEquals(0, cache.localSize(peekMode));
-
-                assertEquals(0, cache.size(peekMode));
-            }
-        }
+        checkEmpty();
 
         if (cacheMode() == LOCAL) {
             IgniteCache<Integer, String> cache0 = jcache(0);
@@ -123,11 +114,74 @@ public abstract class IgniteCacheSizeAbstractTest extends 
IgniteCacheAbstractTes
 
                 assertEquals(size, cacheAsync0.future().get());
             }
+
+            for (int i = 0; i < HEAP_ENTRIES; i++) {
+                cache0.remove(i, String.valueOf(i));
+
+                final int size = HEAP_ENTRIES - i - 1;
+
+                assertEquals(size, cache0.localSize());
+                assertEquals(size, cache0.localSize(PRIMARY));
+                assertEquals(size, cache0.localSize(BACKUP));
+                assertEquals(size, cache0.localSize(NEAR));
+                assertEquals(size, cache0.localSize(ALL));
+
+                assertEquals(size, cache0.size());
+                assertEquals(size, cache0.size(PRIMARY));
+                assertEquals(size, cache0.size(BACKUP));
+                assertEquals(size, cache0.size(NEAR));
+                assertEquals(size, cache0.size(ALL));
+
+                cacheAsync0.size();
+
+                assertEquals(size, cacheAsync0.future().get());
+            }
+
+            checkEmpty();
+
+            for (int i = 0; i < 200; i++)
+                cache0.put(i, "test_val");
+
+            int totalKeys = 200;
+
+            T2<Integer, Integer> swapKeys = swapKeys(0);
+
+            T2<Integer, Integer> offheapKeys = offheapKeys(0);
+
+            int totalSwap = swapKeys.get1() + swapKeys.get2();
+            int totalOffheap = offheapKeys.get1() + offheapKeys.get2();
+
+            log.info("Keys [total=" + totalKeys + ", offheap=" + offheapKeys + 
", swap=" + swapKeys + ']');
+
+            assertTrue(totalSwap + totalOffheap < totalKeys);
+
+            assertEquals(totalKeys, cache0.localSize());
+            assertEquals(totalKeys, cache0.localSize(ALL));
+
+            assertEquals(totalOffheap, cache0.localSize(OFFHEAP));
+            assertEquals(totalSwap, cache0.localSize(SWAP));
+            assertEquals(totalKeys - (totalSwap + totalOffheap), 
cache0.localSize(ONHEAP));
+
+            assertEquals(totalOffheap, cache0.size(OFFHEAP));
+            assertEquals(totalSwap, cache0.size(SWAP));
+            assertEquals(totalKeys - (totalSwap + totalOffheap), 
cache0.size(ONHEAP));
+
+            assertEquals(totalOffheap, cache0.localSize(OFFHEAP, PRIMARY));
+            assertEquals(totalSwap, cache0.localSize(SWAP, PRIMARY));
+            assertEquals(totalKeys - (totalSwap + totalOffheap), 
cache0.localSize(ONHEAP, PRIMARY));
+
+            assertEquals(totalOffheap, cache0.localSize(OFFHEAP, BACKUP));
+            assertEquals(totalSwap, cache0.localSize(SWAP, BACKUP));
+            assertEquals(totalKeys - (totalSwap + totalOffheap), 
cache0.localSize(ONHEAP, BACKUP));
         }
         else {
             checkSizeAffinityFilter(0);
 
             checkSizeAffinityFilter(1);
+
+            checkSizeStorageFilter(0);
+
+            checkSizeStorageFilter(1);
         }
     }
 
@@ -234,11 +288,124 @@ public abstract class IgniteCacheSizeAbstractTest 
extends IgniteCacheAbstractTes
                 assertEquals(primary + backups, cache.localSize(BACKUP, 
PRIMARY));
                 assertEquals(primary + backups, cache.localSize(ALL));
             }
+
+            cache0.remove(keys.get(0));
+
+            checkPrimarySize(PUT_KEYS - 1);
+
+            if (cacheMode() == REPLICATED) {
+                assertEquals(PUT_KEYS - 1, cache0.localSize());
+                assertEquals(0, cache0.localSize(PRIMARY));
+                assertEquals(PUT_KEYS - 1, cache0.localSize(BACKUP));
+            }
+            else {
+                boolean hasNearCache = nodeIdx == 0;
+
+                if (hasNearCache)
+                    assertEquals(PUT_KEYS - 1, cache0.localSize());
+                else
+                    assertEquals(0, cache0.localSize());
+            }
         }
         finally {
             if (keys != null)
                 cache0.removeAll(new HashSet<>(keys));
         }
+
+        checkEmpty();
+    }
+
+    /**
+     * Checks size is zero.
+     */
+    private void checkEmpty() {
+        for (int i = 0; i < gridCount(); i++) {
+            IgniteCache<Integer, String> cache = jcache(i);
+
+            assertEquals(0, cache.localSize());
+
+            assertEquals(0, cache.size());
+
+            for (CachePeekMode peekMode : CachePeekMode.values()) {
+                assertEquals(0, cache.localSize(peekMode));
+
+                assertEquals(0, cache.size(peekMode));
+            }
+        }
+
+        checkPrimarySize(0);
+    }
+
+    /**
+     * @param nodeIdx Node index.
+     * @return Tuple with number of primary and backup keys.
+     */
+    private T2<Integer, Integer> swapKeys(int nodeIdx) {
+        FileSwapSpaceSpi swap = 
(FileSwapSpaceSpi)ignite(nodeIdx).configuration().getSwapSpaceSpi();
+
+        final String spaceName = "gg-swap-cache-dflt";
+
+        IgniteSpiCloseableIterator<Integer> it = swap.keyIterator(spaceName, 
null);
+
+        assertNotNull(it);
+
+        CacheAffinity aff = ignite(nodeIdx).affinity(null);
+
+        ClusterNode node = ignite(nodeIdx).cluster().localNode();
+
+        int primary = 0;
+        int backups = 0;
+
+        while (it.hasNext()) {
+            Integer key = it.next();
+
+            if (aff.isPrimary(node, key))
+                primary++;
+            else {
+                assertTrue(aff.isBackup(node, key));
+
+                backups++;
+            }
+        }
+
+        return new T2<>(primary, backups);
+    }
+
+    /**
+     * @param nodeIdx Node index.
+     * @return Tuple with number of primary and backup keys.
+     */
+    private T2<Integer, Integer> offheapKeys(int nodeIdx) {
+        GridCacheAdapter<Integer, String> internalCache =
+            ((IgniteKernal)ignite(nodeIdx)).context().cache().internalCache();
+
+        Iterator<Map.Entry<Integer, String>> offheapIt;
+
+        if (internalCache.context().isNear())
+            offheapIt = 
internalCache.context().near().dht().context().swap().lazyOffHeapIterator();
+        else
+            offheapIt = internalCache.context().swap().lazyOffHeapIterator();
+
+        CacheAffinity aff = ignite(nodeIdx).affinity(null);
+
+        ClusterNode node = ignite(nodeIdx).cluster().localNode();
+
+        int primary = 0;
+        int backups = 0;
+
+        while (offheapIt.hasNext()) {
+            Map.Entry<Integer, String> e = offheapIt.next();
+
+            if (aff.isPrimary(node, e.getKey()))
+                primary++;
+            else {
+                assertTrue(aff.isBackup(node, e.getKey()));
+
+                backups++;
+            }
+        }
+
+        return new T2<>(primary, backups);
     }
 
     /**
@@ -246,7 +413,62 @@ public abstract class IgniteCacheSizeAbstractTest extends 
IgniteCacheAbstractTes
      * @throws Exception If failed.
      */
     private void checkSizeStorageFilter(int nodeIdx) throws Exception {
+        IgniteCache<Integer, String> cache0 = jcache(nodeIdx);
+
+        List<Integer> primaryKeys = primaryKeys(cache0, 100, 10_000);
+        List<Integer> backupKeys = backupKeys(cache0, 100, 10_000);
+
+        try {
+            final String val = "test_value";
+
+            for (int i = 0; i < 100; i++) {
+                cache0.put(primaryKeys.get(i), val);
+                cache0.put(backupKeys.get(i), val);
+            }
+
+            int totalKeys = 200;
+
+            T2<Integer, Integer> swapKeys = swapKeys(nodeIdx);
+
+            assertTrue(swapKeys.get1() > 0);
+            assertTrue(swapKeys.get2() > 0);
+
+            T2<Integer, Integer> offheapKeys = offheapKeys(nodeIdx);
+
+            assertTrue(offheapKeys.get1() > 0);
+            assertTrue(offheapKeys.get2() > 0);
+
+            int totalSwap = swapKeys.get1() + swapKeys.get2();
+            int totalOffheap = offheapKeys.get1() + offheapKeys.get2();
+
+            log.info("Keys [total=" + totalKeys + ", offheap=" + offheapKeys + 
", swap=" + swapKeys + ']');
+
+            assertTrue(totalSwap + totalOffheap < totalKeys);
+
+            assertEquals(totalKeys, 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(swapKeys.get1(), (Integer)cache0.localSize(SWAP, 
PRIMARY));
+            assertEquals(swapKeys.get2(), (Integer)cache0.localSize(SWAP, 
BACKUP));
+
+            assertEquals(offheapKeys.get1(), 
(Integer)cache0.localSize(OFFHEAP, PRIMARY));
+            assertEquals(offheapKeys.get2(), 
(Integer)cache0.localSize(OFFHEAP, BACKUP));
+
+            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));
+        }
+        finally {
+            cache0.removeAll(new HashSet<>(primaryKeys));
+            cache0.removeAll(new HashSet<>(backupKeys));
+        }
 
+        checkEmpty();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4078998c/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
index fd0b8b0..8ec97f9 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
@@ -148,10 +148,10 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
 
             assertTrue("Failed to insert for index: " + i, 
map.contains(hash(key), key.getBytes()));
             assertEquals(val,  new String(map.get(hash(key), key.getBytes())));
-            assertEquals(i + 1, map.size());
+            assertEquals(i + 1, map.totalSize());
         }
 
-        assert map.size() == 10;
+        assert map.totalSize() == 10;
     }
 
     /**
@@ -188,7 +188,7 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             assertEquals(val, new String(valBytes));
         }
 
-        assert map.size() == 10;
+        assert map.totalSize() == 10;
     }
 
     /**
@@ -205,10 +205,10 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
 
             assertTrue(map.contains(hash(key), key.getBytes()));
             assertEquals(val,  new String(map.get(hash(key), key.getBytes())));
-            assertEquals(i + 1, map.size());
+            assertEquals(i + 1, map.totalSize());
         }
 
-        assert map.size() == 10;
+        assert map.totalSize() == 10;
     }
 
     /**
@@ -225,10 +225,10 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
 
             assertTrue(map.contains(hash(key), key.getBytes()));
             assertEquals(val,  new String(map.get(hash(key), key.getBytes())));
-            assertEquals(i + 1, map.size());
+            assertEquals(i + 1, map.totalSize());
         }
 
-        assertEquals(10, map.size());
+        assertEquals(10, map.totalSize());
     }
 
     /**
@@ -247,16 +247,16 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
 
             assertTrue(map.contains(hash(key), key.getBytes()));
             assertEquals(val1,  new String(map.get(hash(key), 
key.getBytes())));
-            assertEquals(i + 1, map.size());
+            assertEquals(i + 1, map.totalSize());
 
             assertFalse(map.put(hash(key), key.getBytes(), val2.getBytes()));
 
             assertTrue(map.contains(hash(key), key.getBytes()));
             assertEquals(val2,  new String(map.get(hash(key), 
key.getBytes())));
-            assertEquals(i + 1, map.size());
+            assertEquals(i + 1, map.totalSize());
         }
 
-        assertEquals(10, map.size());
+        assertEquals(10, map.totalSize());
     }
 
     /**
@@ -274,7 +274,7 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             assertTrue(map.contains(hash(key), key.getBytes()));
             assertNotNull(map.get(hash(key), key.getBytes()));
             assertEquals(new String(map.get(hash(key), key.getBytes())), val);
-            assertEquals(1, map.size());
+            assertEquals(1, map.totalSize());
 
             byte[] val2 = map.remove(hash(key), key.getBytes());
 
@@ -282,10 +282,10 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             assertEquals(val, new String(val2));
             assertFalse(map.contains(hash(key), key.getBytes()));
             assertNull(map.get(hash(key), key.getBytes()));
-            assertEquals(0, map.size());
+            assertEquals(0, map.totalSize());
         }
 
-        assertEquals(0, map.size());
+        assertEquals(0, map.totalSize());
     }
 
     /**
@@ -303,17 +303,17 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             assertTrue(map.contains(hash(key), key.getBytes()));
             assertNotNull(map.get(hash(key), key.getBytes()));
             assertEquals(new String(map.get(hash(key), key.getBytes())), val);
-            assertEquals(1, map.size());
+            assertEquals(1, map.totalSize());
 
             boolean rmvd = map.removex(hash(key), key.getBytes());
 
             assertTrue(rmvd);
             assertFalse(map.contains(hash(key), key.getBytes()));
             assertNull(map.get(hash(key), key.getBytes()));
-            assertEquals(0, map.size());
+            assertEquals(0, map.totalSize());
         }
 
-        assertEquals(0, map.size());
+        assertEquals(0, map.totalSize());
     }
 
     /**
@@ -377,12 +377,12 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
                 }
             }
 
-            assertEquals(map.size(), cnt);
+            assertEquals(map.totalSize(), cnt);
         }
 
-        assertEquals(max, map.size());
+        assertEquals(max, map.totalSize());
 
-        info("Stats [size=" + map.size() + ", rehashes=" + rehashes + ", 
releases=" + releases + ']');
+        info("Stats [size=" + map.totalSize() + ", rehashes=" + rehashes + ", 
releases=" + releases + ']');
 
         assertTrue(rehashes.get() > 0);
         assertEquals(rehashes.get(), releases.get());
@@ -454,9 +454,9 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             }
         }, threads);
 
-        assertEquals(max * threads, map.size());
+        assertEquals(max * threads, map.totalSize());
 
-        info("Stats [size=" + map.size() + ", rehashes=" + rehashes + ", 
releases=" + releases + ']');
+        info("Stats [size=" + map.totalSize() + ", rehashes=" + rehashes + ", 
releases=" + releases + ']');
 
         assertTrue(rehashes.get() > 0);
         assertEquals(rehashes.get(), releases.get());
@@ -491,7 +491,7 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             assertTrue(map.contains(hash(key), key.getBytes()));
             assertNotNull(map.get(hash(key), key.getBytes()));
             assertEquals(new String(map.get(hash(key), key.getBytes())), val);
-            assertEquals(++cnt, map.size());
+            assertEquals(++cnt, map.totalSize());
         }
     }
 
@@ -527,7 +527,7 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             assertTrue(map.contains(hash(key), key.getBytes()));
             assertNotNull(map.get(hash(key), key.getBytes()));
             assertEquals(new String(map.get(hash(key), key.getBytes())), val);
-            assertEquals(++cnt, map.size());
+            assertEquals(++cnt, map.totalSize());
         }
     }
 
@@ -563,7 +563,7 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             info("Evicted: " + evictCnt);
 
             assertEquals(1, evictCnt.get());
-            assertEquals(0, map.size());
+            assertEquals(0, map.totalSize());
 
             assertTrue(evictCnt.compareAndSet(1, 0));
         }
@@ -643,7 +643,7 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
             }
         }, 10);
 
-        info("Map stats [evicted=" + evictCnt + ", size=" + map.size() + ", 
allocated=" + map.allocatedSize() +
+        info("Map stats [evicted=" + evictCnt + ", size=" + map.totalSize() + 
", allocated=" + map.allocatedSize() +
             ", freeSize=" + map.freeSize() + ']');
 
         assertTrue(map.freeSize() >= 0);
@@ -805,7 +805,7 @@ public abstract class GridOffHeapMapAbstractSelfTest 
extends GridCommonAbstractT
         for (byte[] key : keys)
             map.remove(key[0], key);
 
-        assertEquals(0, map.size());
+        assertEquals(0, map.totalSize());
         assertEquals(0, ((GridUnsafeMap)map).lruSize());
 
         assertEquals(zeroAllocated, map.allocatedSize());

Reply via email to