ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [46/46] incubator-ignite git commit: #ignite-286: wip
Date Thu, 23 Apr 2015 16:02:34 GMT
#ignite-286: wip


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

Branch: refs/heads/ignite-286
Commit: 8a0e27c9e316af2a19fdad01d44a53735472c639
Parents: 32f118d
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Apr 23 19:01:27 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Apr 23 19:01:27 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheSwapManager.java  |  34 +++++
 .../processors/cache/local/GridLocalCache.java  |   4 +-
 .../local/atomic/GridLocalAtomicCache.java      |   4 +-
 .../cache/query/GridCacheQueryManager.java      |  24 +++-
 .../transactions/IgniteTxLocalAdapter.java      |   2 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java | 128 +++++++++----------
 .../cache/GridCacheAbstractSelfTest.java        |   4 +-
 ...achePartitionedMultiNodeFullApiSelfTest.java |   2 +-
 ...edOffHeapTieredMultiNodeFullApiSelfTest.java |  13 +-
 .../IgniteCacheFullApiSelfTestSuite.java        |   2 +-
 10 files changed, 136 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index fb6b103..7b2d368 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1615,6 +1615,40 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     }
 
     /**
+     * @return Raw off-heap iterator.
+     */
+    public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawOffHeapIterator(final
int part) {
+        if (!offheapEnabled)
+            return new GridEmptyCloseableIterator<>();
+
+        return new GridCloseableIteratorAdapter<Map.Entry<byte[], byte[]>>()
{
+            private GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> it =
offheap.iterator(spaceName, part);
+
+            private Map.Entry<byte[], byte[]> cur;
+
+            @Override protected Map.Entry<byte[], byte[]> onNext() {
+                return cur = it.next();
+            }
+
+            @Override protected boolean onHasNext() {
+                return it.hasNext();
+            }
+
+            @Override protected void onRemove() throws IgniteCheckedException {
+                KeyCacheObject key = cctx.toCacheKeyObject(cur.getKey());
+
+                int part = cctx.affinity().partition(key);
+
+                offheap.removex(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
+            }
+
+            @Override protected void onClose() throws IgniteCheckedException {
+                it.close();
+            }
+        };
+    }
+
+    /**
      * Gets swap space iterator over partition.
      *
      * @param part Partition to iterate over.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
index 147b131..e00687f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
@@ -206,9 +206,11 @@ public class GridLocalCache<K, V> extends GridCacheAdapter<K,
V> {
     @Override public void removeAll() throws IgniteCheckedException {
         Set<K> keys = new HashSet<>();
 
-        for (Cache.Entry<K, V> e: localEntries(new CachePeekMode[]{CachePeekMode.ALL}))
+        for (Cache.Entry<K, V> e : localEntries(new CachePeekMode[]{CachePeekMode.ALL}))
             keys.add(e.getKey());
 
+        keys.addAll(keySet());
+
         removeAll(keys);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/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 924eb8d..3db93fb 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
@@ -384,9 +384,11 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
     @Override public void removeAll() throws IgniteCheckedException {
         Set<K> keys = new HashSet<>();
 
-        for (Cache.Entry<K, V> e: localEntries(new CachePeekMode[]{CachePeekMode.ALL}))
+        for (Cache.Entry<K, V> e : localEntries(new CachePeekMode[]{CachePeekMode.ALL}))
             keys.add(e.getKey());
 
+        keys.addAll(keySet());
+
         removeAll(keys);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 16063af..8a9424f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -774,6 +774,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
         final ExpiryPolicy plc = cctx.expiry();
 
+        Set<Integer> parts = qry.includeBackups() || cctx.isReplicated() ? null :
+            cctx.affinity().primaryPartitions(cctx.nodeId(), cctx.affinity().affinityTopologyVersion());
+
         final GridCloseableIteratorAdapter<IgniteBiTuple<K, V>> heapIt = new
GridCloseableIteratorAdapter<IgniteBiTuple<K, V>>() {
             private IgniteBiTuple<K, V> next;
 
@@ -876,7 +879,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
             iters.add(heapIt);
 
             if (cctx.isOffHeapEnabled())
-                iters.add(offheapIterator(qry));
+                iters.add(offheapIterator(qry, parts));
 
             if (cctx.swap().swapEnabled())
                 iters.add(swapIterator(qry));
@@ -929,7 +932,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
      * @param qry Query.
      * @return Offheap iterator.
      */
-    private GridIterator<IgniteBiTuple<K, V>> offheapIterator(GridCacheQueryAdapter<?>
qry) {
+    private GridIterator<IgniteBiTuple<K, V>> offheapIterator(GridCacheQueryAdapter<?>
qry, Set<Integer> parts)
+        throws IgniteCheckedException {
         IgniteBiPredicate<K, V> filter = qry.scanFilter();
 
         if (cctx.offheapTiered() && filter != null) {
@@ -938,7 +942,19 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
             return cctx.swap().rawOffHeapIterator(c);
         }
         else {
-            Iterator<Map.Entry<byte[], byte[]>> it = cctx.swap().rawOffHeapIterator();
+            Iterator<Map.Entry<byte[], byte[]>> it;
+
+            if (parts == null)
+                it = cctx.swap().rawOffHeapIterator();
+            else {
+                List<GridIterator<Map.Entry<byte[], byte[]>>> partIts =
new ArrayList<>();
+
+                for (Integer part : parts)
+                    partIts.add(cctx.swap().rawOffHeapIterator(part));
+
+                it = new CompoundIterator(partIts);
+            }
+
 
             return scanIterator(it, filter, qry.keepPortable());
         }
@@ -2467,7 +2483,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
          * @param keepPortable Keep portable flag.
          */
         private OffheapIteratorClosure(
-            @Nullable IgniteBiPredicate<K, V> filter,
+            IgniteBiPredicate<K, V> filter,
             boolean keepPortable) {
             assert filter != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 5bd4fdf..1fa0b8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -2897,7 +2897,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             throws IgniteCheckedException {
                             txFut.get();
 
-                            return (GridCacheReturn)implicitRes;
+                            return implicitRes;
                         }
                     }));
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/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 6496b00..36043d8 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
@@ -22,6 +22,7 @@ import junit.framework.*;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
@@ -49,6 +50,7 @@ import java.util.concurrent.locks.*;
 import static java.util.concurrent.TimeUnit.*;
 import static org.apache.ignite.cache.CacheMemoryMode.*;
 import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CachePeekMode.*;
 import static org.apache.ignite.events.EventType.*;
 import static org.apache.ignite.testframework.GridTestUtils.*;
 import static org.apache.ignite.transactions.TransactionConcurrency.*;
@@ -271,7 +273,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             // Will actually delete entry from map.
             CU.invalidate(jcache(i), "key0");
 
-            assertNull("Failed check for grid: " + i, jcache(i).localPeek("key0", CachePeekMode.ONHEAP));
+            assertNull("Failed check for grid: " + i, jcache(i).localPeek("key0", ONHEAP));
 
             Collection<String> keysCol = mapped.get(grid(i).localNode());
 
@@ -734,7 +736,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assertNull(cache.get("key3"));
 
         for (int i = 0; i < gridCount(); i++)
-            assertNull("Failed for cache: " + i, jcache(i).localPeek("key3", CachePeekMode.ONHEAP));
+            assertNull("Failed for cache: " + i, jcache(i).localPeek("key3", ONHEAP));
 
         cache.remove("key1");
         cache.put("key2", 1);
@@ -749,7 +751,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assertNull(cache.get("key3"));
 
         for (int i = 0; i < gridCount(); i++)
-            assertNull(jcache(i).localPeek("key3", CachePeekMode.ONHEAP));
+            assertNull(jcache(i).localPeek("key3", ONHEAP));
     }
 
     /**
@@ -788,7 +790,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assertNull(cache.get("key3"));
 
         for (int i = 0; i < gridCount(); i++)
-            assertNull("Failed for cache: " + i, jcache(i).localPeek("key3", CachePeekMode.ONHEAP));
+            assertNull("Failed for cache: " + i, jcache(i).localPeek("key3", ONHEAP));
 
         cache.remove("key1");
         cache.put("key2", 1);
@@ -803,7 +805,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assertNull(cache.get("key3"));
 
         for (int i = 0; i < gridCount(); i++)
-            assertNull(jcache(i).localPeek("key3", CachePeekMode.ONHEAP));
+            assertNull(jcache(i).localPeek("key3", ONHEAP));
     }
 
     /**
@@ -873,9 +875,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         Map<String, EntryProcessorResult<String>> res = cache.invokeAll(F.asSet("key1",
"key2", "key3"), RMV_PROCESSOR);
 
         for (int i = 0; i < gridCount(); i++) {
-            assertNull(jcache(i).localPeek("key1", CachePeekMode.ONHEAP));
-            assertNull(jcache(i).localPeek("key2", CachePeekMode.ONHEAP));
-            assertNull(jcache(i).localPeek("key3", CachePeekMode.ONHEAP));
+            assertNull(jcache(i).localPeek("key1", ONHEAP));
+            assertNull(jcache(i).localPeek("key2", ONHEAP));
+            assertNull(jcache(i).localPeek("key3", ONHEAP));
         }
 
         assertEquals("null", res.get("key1").get());
@@ -921,7 +923,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testTransformAllWithNulls() throws Exception {
-     /*   final IgniteCache<String, Integer> cache = jcache();
+        final IgniteCache<String, Integer> cache = jcache();
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
@@ -960,7 +962,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
                     return null;
                 }
             }, NullPointerException.class, null);
-        }*/
+        }
     }
 
     /**
@@ -1078,7 +1080,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
                 tx.close();
         }
 
-        assertEquals((Integer) 3, cache.get("key"));
+        assertEquals((Integer)3, cache.get("key"));
     }
 
     /**
@@ -1231,7 +1233,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assertNull(cache.get("key3"));
 
         for (int i = 0; i < gridCount(); i++)
-            assertNull(jcache(i).localPeek("key3", CachePeekMode.ONHEAP));
+            assertNull(jcache(i).localPeek("key3", ONHEAP));
     }
 
     /**
@@ -1270,7 +1272,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assertNull(cache.get("k1"));
 
         for (int i = 0; i < gridCount(); i++)
-            assertNull(jcache(i).localPeek("k1", CachePeekMode.ONHEAP));
+            assertNull(jcache(i).localPeek("k1", ONHEAP));
 
         final EntryProcessor<String, Integer, Integer> errProcessor = new EntryProcessor<String,
Integer, Integer>() {
             @Override public Integer process(MutableEntry<String, Integer> e, Object...
args) {
@@ -1549,9 +1551,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }
 
         assertThrows(log, new Callable<Object>() {
-            @Nullable
-            @Override
-            public Object call() throws Exception {
+            @Nullable @Override public Object call() throws Exception {
                 cache.put("key1", null);
 
                 return null;
@@ -1567,9 +1567,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }, NullPointerException.class, A.NULL_MSG_PREFIX);
 
         assertThrows(log, new Callable<Object>() {
-            @Nullable
-            @Override
-            public Object call() throws Exception {
+            @Nullable @Override public Object call() throws Exception {
                 cache.put(null, 1);
 
                 return null;
@@ -1577,9 +1575,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }, NullPointerException.class, A.NULL_MSG_PREFIX);
 
         assertThrows(log, new Callable<Object>() {
-            @Nullable
-            @Override
-            public Object call() throws Exception {
+            @Nullable @Override public Object call() throws Exception {
                 cache.replace(null, 1);
 
                 return null;
@@ -1587,9 +1583,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }, NullPointerException.class, A.NULL_MSG_PREFIX);
 
         assertThrows(log, new Callable<Object>() {
-            @Nullable
-            @Override
-            public Object call() throws Exception {
+            @Nullable @Override public Object call() throws Exception {
                 cache.getAndReplace(null, 1);
 
                 return null;
@@ -1605,9 +1599,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }, NullPointerException.class, A.NULL_MSG_PREFIX);
 
         assertThrows(log, new Callable<Object>() {
-            @Nullable
-            @Override
-            public Object call() throws Exception {
+            @Nullable @Override public Object call() throws Exception {
                 cache.getAndReplace("key", null);
 
                 return null;
@@ -1615,9 +1607,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }, NullPointerException.class, A.NULL_MSG_PREFIX);
 
         assertThrows(log, new Callable<Object>() {
-            @Nullable
-            @Override
-            public Object call() throws Exception {
+            @Nullable @Override public Object call() throws Exception {
                 cache.replace(null, 1, 2);
 
                 return null;
@@ -1625,9 +1615,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }, NullPointerException.class, A.NULL_MSG_PREFIX);
 
         assertThrows(log, new Callable<Object>() {
-            @Nullable
-            @Override
-            public Object call() throws Exception {
+            @Nullable @Override public Object call() throws Exception {
                 cache.replace("key", null, 2);
 
                 return null;
@@ -1705,10 +1693,10 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         for (int i = 0; i < gridCount(); i++) {
             info("Peek on node [i=" + i + ", id=" + grid(i).localNode().id() + ", val=" +
-                grid(i).cache(null).localPeek("key", CachePeekMode.ONHEAP) + ']');
+                grid(i).cache(null).localPeek("key", ONHEAP) + ']');
         }
 
-        assertEquals((Integer) 1, cache.getAndPutIfAbsent("key", 2));
+        assertEquals((Integer)1, cache.getAndPutIfAbsent("key", 2));
 
         assert cache.get("key") != null;
         assert cache.get("key") == 1;
@@ -1718,7 +1706,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         cache.localEvict(Collections.singleton("key2"));
 
-        assertEquals((Integer) 1, cache.getAndPutIfAbsent("key2", 3));
+        assertEquals((Integer)1, cache.getAndPutIfAbsent("key2", 3));
 
         // Check db.
         putToStore("key3", 3);
@@ -1787,14 +1775,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         cacheAsync.getAndPutIfAbsent("key2", 3);
 
-        assertEquals((Integer) 1, cacheAsync.<Integer>future().get());
+        assertEquals((Integer)1, cacheAsync.<Integer>future().get());
 
         // Check db.
         putToStore("key3", 3);
 
         cacheAsync.getAndPutIfAbsent("key3", 4);
 
-        assertEquals((Integer) 3, cacheAsync.<Integer>future().get());
+        assertEquals((Integer)3, cacheAsync.<Integer>future().get());
 
         cache.localEvict(Collections.singleton("key2"));
 
@@ -2014,10 +2002,10 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         for (int i = 0; i < gridCount(); i++) {
             info("Peek key on grid [i=" + i + ", nodeId=" + grid(i).localNode().id() +
-                ", peekVal=" + grid(i).cache(null).localPeek("key", CachePeekMode.ONHEAP)
+ ']');
+                ", peekVal=" + grid(i).cache(null).localPeek("key", ONHEAP) + ']');
 
             info("Peek key2 on grid [i=" + i + ", nodeId=" + grid(i).localNode().id() +
-                ", peekVal=" + grid(i).cache(null).localPeek("key2", CachePeekMode.ONHEAP)
+ ']');
+                ", peekVal=" + grid(i).cache(null).localPeek("key2", ONHEAP) + ']');
         }
 
         assertEquals((Integer)6, cache.get("key2"));
@@ -2246,7 +2234,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testDeletedEntriesFlag() throws Exception {
-        if (cacheMode() != LOCAL && cacheMode() != REPLICATED) {
+        if (cacheMode() != LOCAL && cacheMode() != REPLICATED && memoryMode()
!= OFFHEAP_TIERED) {
             int cnt = 3;
 
             IgniteCache<String, Integer> cache = jcache();
@@ -2263,8 +2251,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
                     GridCacheContext<String, Integer> cctx = context(g);
 
-                    GridCacheEntryEx entry = cctx.isNear() ? cctx.near().dht().entryEx(key)
:
-                        cctx.cache().entryEx(key);
+                    GridCacheEntryEx entry = cctx.isNear() ? cctx.near().dht().peekEx(key)
:
+                        cctx.cache().peekEx(key);
 
                     if (grid(0).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode()))
{
                         assertNotNull(entry);
@@ -2480,7 +2468,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         c.add(null);
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
+            @Override
+            public Void call() throws Exception {
                 cache.removeAll(c);
 
                 return null;
@@ -2581,7 +2570,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         Set<String> keys = new HashSet<>(primaryKeysForCache(cache, 2));
 
         for (String key : keys)
-            assertNull(cache.localPeek(key, CachePeekMode.ONHEAP));
+            assertNull(cache.localPeek(key, ONHEAP));
 
         Map<String, Integer> vals = new HashMap<>();
 
@@ -2715,7 +2704,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             try {
                 cache.clear();
 
-                assertEquals(vals.get(first), peek(cache, first));
+                assertEquals(vals.get(first), cache.localPeek(first, ONHEAP));
             }
             finally {
                 lock.unlock();
@@ -2746,14 +2735,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         cache.localEvict(Sets.union(ImmutableSet.of("key1", "key2"), keys));
 
-        assert cache.localSize(CachePeekMode.ONHEAP) == 0;
+        assert cache.localSize(ONHEAP) == 0;
 
         cache.clear();
 
         cache.localPromote(ImmutableSet.of("key2", "key1"));
 
-        assert cache.localPeek("key1", CachePeekMode.ONHEAP) == null;
-        assert cache.localPeek("key2", CachePeekMode.ONHEAP) == null;
+        assert cache.localPeek("key1", ONHEAP) == null;
+        assert cache.localPeek("key2", ONHEAP) == null;
     }
 
     /**
@@ -2918,7 +2907,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         Ignite ignite = primaryIgnite("key");
         IgniteCache<String, Integer> cache = ignite.cache(null);
 
-        assert cache.localPeek("key", CachePeekMode.ONHEAP) == null;
+        assert cache.localPeek("key", ONHEAP) == null;
 
         cache.put("key", 1);
 
@@ -3002,7 +2991,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         cache.localPromote(Collections.singleton(key));
 
-        assertNull(cache.localPeek(key, CachePeekMode.ONHEAP));
+        assertNull(cache.localPeek(key, ONHEAP));
 
         assertTrue(cache.localSize() == 0);
 
@@ -3070,7 +3059,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
             Thread.sleep(ttl + 100);
 
-            assertNull(c.localPeek(key, CachePeekMode.ONHEAP));
+            assertNull(c.localPeek(key, ONHEAP));
 
             assert c.localSize() == 0;
         }
@@ -3382,8 +3371,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         cache.localEvict(F.asList(key1, key2));
 
-        assert cache.localPeek(key1, CachePeekMode.ONHEAP) == null;
-        assert cache.localPeek(key2, CachePeekMode.ONHEAP) == null;
+        assert cache.localPeek(key1, ONHEAP) == null;
+        assert cache.localPeek(key2, ONHEAP) == null;
         assert peek(cache, key3) == 3;
 
         loadAll(cache, ImmutableSet.of(key1, key2), true);
@@ -3456,14 +3445,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         cache.localEvict(F.asList(k2, k3));
 
         if (memoryMode() == OFFHEAP_TIERED) {
-            assertNotNull(cache.localPeek(k1, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
-            assertNotNull(cache.localPeek(k2, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
-            assertNotNull(cache.localPeek(k3, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
+            assertNotNull(cache.localPeek(k1, ONHEAP, CachePeekMode.OFFHEAP));
+            assertNotNull(cache.localPeek(k2, ONHEAP, CachePeekMode.OFFHEAP));
+            assertNotNull(cache.localPeek(k3, ONHEAP, CachePeekMode.OFFHEAP));
         }
         else {
-            assertNotNull(cache.localPeek(k1, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
-            assertNull(cache.localPeek(k2, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
-            assertNull(cache.localPeek(k3, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
+            assertNotNull(cache.localPeek(k1, ONHEAP, CachePeekMode.OFFHEAP));
+            assertNull(cache.localPeek(k2, ONHEAP, CachePeekMode.OFFHEAP));
+            assertNull(cache.localPeek(k3, ONHEAP, CachePeekMode.OFFHEAP));
         }
 
         int cnt = 0;
@@ -3529,14 +3518,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         cache.localEvict(Collections.singleton(k3));
 
         if (memoryMode() == OFFHEAP_TIERED) {
-            assertNotNull(cache.localPeek(k1, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
-            assertNotNull(cache.localPeek(k2, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
-            assertNotNull(cache.localPeek(k3, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
+            assertNotNull(cache.localPeek(k1, ONHEAP, CachePeekMode.OFFHEAP));
+            assertNotNull(cache.localPeek(k2, ONHEAP, CachePeekMode.OFFHEAP));
+            assertNotNull(cache.localPeek(k3, ONHEAP, CachePeekMode.OFFHEAP));
         }
         else {
-            assertNotNull(cache.localPeek(k1, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
-            assertNull(cache.localPeek(k2, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
-            assertNull(cache.localPeek(k3, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
+            assertNotNull(cache.localPeek(k1, ONHEAP, CachePeekMode.OFFHEAP));
+            assertNull(cache.localPeek(k2, ONHEAP, CachePeekMode.OFFHEAP));
+            assertNull(cache.localPeek(k3, ONHEAP, CachePeekMode.OFFHEAP));
         }
 
         cache.localPromote(F.asSet(k2, k3));
@@ -3585,7 +3574,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         Thread.sleep(ttl + 100);
 
         // Peek will actually remove entry from cache.
-        assertNull(cache.localPeek(key, CachePeekMode.ONHEAP));
+        assertNull(cache.localPeek(key, ONHEAP));
 
         assert cache.localSize() == 0;
 
@@ -3773,6 +3762,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     protected void checkSize(Collection<String> keys) throws Exception {
+        if (memoryMode() == OFFHEAP_TIERED)
+            return;
+
         if (nearEnabled())
             assertEquals(keys.size(), jcache().localSize(CachePeekMode.ALL));
         else {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/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 fd853ab..f329ebb 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
@@ -395,8 +395,8 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest
{
      * @throws Exception If failed.
      */
     @Nullable protected <K, V> V peek(IgniteCache<K, V> cache, K key) throws
Exception {
-        return offheapTiered(cache) ? cache.localPeek(key, CachePeekMode.SWAP, CachePeekMode.OFFHEAP)
: cache.localPeek(key,
-            CachePeekMode.ONHEAP);
+        return offheapTiered(cache) ? cache.localPeek(key, CachePeekMode.SWAP, CachePeekMode.OFFHEAP)
:
+            cache.localPeek(key, CachePeekMode.ONHEAP);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/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 eca3ef0..1a780df 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
@@ -330,7 +330,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         assertEquals(0, cache1.localSize(NEAR));
         assertEquals(5, cache1.localSize(CachePeekMode.ALL) - cache1.localSize(NEAR));
 
-        assertEquals(nearEnabled() ? 2 : 0, cache2.localSize(NEAR));
+        assertEquals(nearEnabled() && memoryMode() != CacheMemoryMode.OFFHEAP_TIERED
? 2 : 0, cache2.localSize(NEAR));
         assertEquals(0, cache2.localSize(CachePeekMode.ALL) - cache2.localSize(NEAR));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest.java
index 0b52264..cce39aa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest.java
@@ -24,10 +24,19 @@ import static org.apache.ignite.cache.CacheMemoryMode.*;
 /**
  * Tests partitioned cache with off-heap tiered mode.
  */
-public class GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest extends
-    GridCachePartitionedOffHeapMultiNodeFullApiSelfTest {
+public class GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest extends GridCachePartitionedFullApiSelfTest
{
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
     /** {@inheritDoc} */
     @Override protected CacheMemoryMode memoryMode() {
         return OFFHEAP_TIERED;
     }
+
+    /** {@inheritDoc} */
+    @Override protected boolean nearEnabled() {
+        return false;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a0e27c9/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
index 9f82086..0bf28a0 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
@@ -123,7 +123,7 @@ public class IgniteCacheFullApiSelfTestSuite extends TestSuite {
 
         // Multi-node with off-heap tiered mode.
         suite.addTestSuite(GridCacheReplicatedOffHeapTieredMultiNodeFullApiSelfTest.class);
-        //suite.addTestSuite(GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest.class);
+        suite.addTestSuite(GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicOffHeapTieredMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedNearDisabledOffHeapTieredMultiNodeFullApiSelfTest.class);


Mime
View raw message