ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/2] incubator-ignite git commit: #ignite-286: wip.
Date Tue, 28 Apr 2015 13:20:23 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-286 98947a156 -> ba3a79f79


#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/4e55edb8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4e55edb8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4e55edb8

Branch: refs/heads/ignite-286
Commit: 4e55edb8b0670602faa26c7b688830fd4f33646e
Parents: 98947a1
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Tue Apr 28 16:01:31 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Tue Apr 28 16:01:31 2015 +0300

----------------------------------------------------------------------
 ...edOffHeapTieredMultiNodeFullApiSelfTest.java | 115 +++++++++++++++++++
 1 file changed, 115 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e55edb8/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 5534d95..01e60fd 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
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 
 import static org.apache.ignite.cache.CacheMemoryMode.*;
@@ -34,4 +35,118 @@ public class GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest
extends G
     @Override protected CacheMemoryMode memoryMode() {
         return OFFHEAP_TIERED;
     }
+
+    /**
+    * @throws Exception If failed.
+    */
+    public void testPutRemoveWithSkipStore() throws Exception {
+        IgniteCache<String, Integer> cache = grid(0).cache(null);
+        IgniteCache<String, Integer> cacheSkipStore = cache.withSkipStore();
+
+        String key = "key_" + 4;
+
+        map.put(key, 4);
+
+        IgniteCache<String, Integer> primaryCache = primaryCache(key);
+
+        assertFalse(grid(0).affinity(null).isPrimary(grid(0).localNode(), key));
+        assertFalse(grid(0).affinity(null).isBackup(grid(0).localNode(), key));
+
+        assertNull(cacheSkipStore.get(key));
+        assertEquals(4, cache.get(key).intValue());
+        assertNull(primaryCache.localPeek(key, CachePeekMode.ONHEAP));
+        assertEquals(4, primaryCache.localPeek(key, CachePeekMode.OFFHEAP).intValue());
+
+        cacheSkipStore.put(key, 5);
+
+        assertEquals(5, primaryCache.localPeek(key, CachePeekMode.ONHEAP).intValue());
+        assertEquals(5, primaryCache.localPeek(key, CachePeekMode.OFFHEAP).intValue());
+        assertEquals(5, cacheSkipStore.get(key).intValue());
+        assertEquals(5, cache.get(key).intValue());
+        assertEquals(4, map.get(key));
+
+        /*
+
+        cache.put(key, 4);
+
+        for (int i = 0; i < gridCount(); ++i) {
+            System.out.println("After put : Grid " + i +
+                " is primary " + grid(0).affinity(null).isPrimary(grid(i).localNode(), key)
+
+                " is backup " + grid(0).affinity(null).isBackup(grid(i).localNode(), key));
+            System.out.println("After put : On heap "  + grid(i).cache(null).withSkipStore().localPeek(key,
ONHEAP_PEEK_MODES));
+            System.out.println("After put : Off heap "  + grid(i).cache(null).withSkipStore().localPeek(key,
CachePeekMode.OFFHEAP));
+        }
+
+        assertEquals(4, cacheSkipStore.get(key).intValue());
+        assertEquals(4, cache.get(key).intValue());
+        assertEquals(4, map.get(key));
+
+        for (int i = 0; i < gridCount(); ++i) {
+            System.out.println("After put + get: Grid " + i +
+                " is primary " + grid(0).affinity(null).isPrimary(grid(i).localNode(), key)
+
+                " is backup " + grid(0).affinity(null).isBackup(grid(i).localNode(), key));
+            System.out.println("After put + get: On heap "  + grid(i).cache(null).localPeek(key,
ONHEAP_PEEK_MODES));
+            System.out.println("After put + get: Off heap "  + grid(i).cache(null).localPeek(key,
CachePeekMode.OFFHEAP));
+        }
+        cacheSkipStore.remove(key);
+
+        for (int i = 0; i < gridCount(); ++i) {
+            System.out.println("After put + get + remove: Grid " + i +
+                " is primary " + grid(0).affinity(null).isPrimary(grid(i).localNode(), key)
+
+                " is backup " + grid(0).affinity(null).isBackup(grid(i).localNode(), key));
+            System.out.println("After put + get + remove: On heap "  + grid(i).cache(null).withSkipStore().localPeek(key,
ONHEAP_PEEK_MODES));
+            System.out.println("After put + get + remove: Off heap "  + grid(i).cache(null).withSkipStore().localPeek(key,
CachePeekMode.OFFHEAP));
+        }
+
+        assertNull(cacheSkipStore.get(key));
+        assertEquals(4, cache.get(key).intValue());
+        assertEquals(4, map.get(key));
+
+        for (int i = 0; i < gridCount(); ++i) {
+            System.out.println("After put + get + remove + get: Grid " + i +
+                " is primary " + grid(0).affinity(null).isPrimary(grid(i).localNode(), key)
+
+                " is backup " + grid(0).affinity(null).isBackup(grid(i).localNode(), key));
+            System.out.println("After put + get + remove + get: On heap "  + grid(i).cache(null).withSkipStore().localPeek(key,
ONHEAP_PEEK_MODES));
+            System.out.println("After put + get + remove + get: Off heap "  + grid(i).cache(null).withSkipStore().localPeek(key,
CachePeekMode.OFFHEAP));
+        }
+
+        cacheSkipStore.put(key, 5);
+        for (int i = 0; i < gridCount(); ++i) {
+            System.out.println("After put + get + remove + get + put: Grid " + i +
+                " is primary " + grid(0).affinity(null).isPrimary(grid(i).localNode(), key)
+
+                " is backup " + grid(0).affinity(null).isBackup(grid(i).localNode(), key));
+            System.out.println("After put + get + remove + get + put: On heap "  + grid(i).cache(null).withSkipStore().localPeek(key,
ONHEAP_PEEK_MODES));
+            System.out.println("After put + get + remove + get + put: Off heap "  + grid(i).cache(null).withSkipStore().localPeek(key,
CachePeekMode.OFFHEAP));
+        }
+
+        assertEquals(5, cacheSkipStore.get(key).intValue());
+        assertEquals(5, cache.get(key).intValue());
+        assertEquals(4, map.get(key));
+
+        map.put(key, 6);
+
+        for (int i = 0; i < gridCount(); ++i) {
+            System.out.println("After put + get + remove + get + put + get: Grid " + i +
+                " is primary " + grid(0).affinity(null).isPrimary(grid(i).localNode(), key)
+
+                " is backup " + grid(0).affinity(null).isBackup(grid(i).localNode(), key));
+            System.out.println("After put + get + remove + get + put + get: On heap "  +
grid(i).cache(null).withSkipStore().localPeek(key, ONHEAP_PEEK_MODES));
+            System.out.println("After put + get + remove + get + put + get: Off heap "  +
grid(i).cache(null).withSkipStore().localPeek(key, CachePeekMode.OFFHEAP));
+        }
+
+
+        assertTrue(cacheSkipStore.remove(key));
+
+        for (int i = 0; i < gridCount(); ++i) {
+            System.out.println("After put + get + remove + get + put + get + remove: Grid
" + i +
+                " is primary " + grid(0).affinity(null).isPrimary(grid(i).localNode(), key)
+
+                " is backup " + grid(0).affinity(null).isBackup(grid(i).localNode(), key));
+            System.out.println("After put + get + remove + get + put + get + remove: On heap
"  + grid(i).cache(null).withSkipStore().localPeek(key, ONHEAP_PEEK_MODES));
+            System.out.println("After put + get + remove + get + put + get + remove: Off
heap "  + grid(i).cache(null).withSkipStore().localPeek(key, CachePeekMode.OFFHEAP));
+        }
+
+        assertNull(cacheSkipStore.get(key));
+        assertEquals(6, cache.get(key).intValue());
+        assertNotNull(map.get(key));*/
+    }
+
 }


Mime
View raw message