ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [02/50] [abbrv] incubator-ignite git commit: Fix IgniteCacheIterator
Date Mon, 02 Feb 2015 11:35:21 GMT
Fix IgniteCacheIterator


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

Branch: refs/heads/ignite-16
Commit: 9900ae49ba2b839eb3c549bb95cdf397743a8303
Parents: 4535322
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Jan 29 18:14:08 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Jan 29 18:14:08 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 16 ++-----
 .../processors/cache/IgniteCacheProxy.java      |  2 +-
 .../GridCacheAbstractProjectionSelfTest.java    | 50 ++++++++++++++++++++
 3 files changed, 54 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9900ae49/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 92d2039..1c04d29 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
@@ -3887,10 +3887,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
     }
 
     /**
-     * @param prj Projection.
+     * @param delegate Cache proxy.
      * @return Distributed ignite cache iterator.
      */
-    public Iterator<Cache.Entry<K, V>> igniteIterator(final GridCacheProjectionImpl<K,
V> prj) {
+    public Iterator<Cache.Entry<K, V>> igniteIterator(final IgniteCacheProxy<K,
V> delegate) {
         CacheQueryFuture<Map.Entry<K, V>> fut = queries().createScanQuery(null)
             .keepAll(false)
             .execute();
@@ -3901,17 +3901,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
             }
 
             @Override protected void remove(Cache.Entry<K, V> item) {
-                GridCacheProjectionImpl<K, V> prev = ctx.gate().enter(prj);
-
-                try {
-                    GridCacheAdapter.this.removex(item.getKey());
-                }
-                catch (IgniteCheckedException e) {
-                    throw new CacheException(e);
-                }
-                finally {
-                    ctx.gate().leave(prev);
-                }
+                delegate.remove(item.getKey());
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9900ae49/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 743e5b9..0bb2543 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -943,7 +943,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter<IgniteCach
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
-            return ((GridCacheAdapter)delegate).igniteIterator(prj);
+            return ctx.cache().igniteIterator(this);
         }
         finally {
             gate.leave(prev);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9900ae49/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
index 6337339..acdeede 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
@@ -617,6 +617,56 @@ public abstract class GridCacheAbstractProjectionSelfTest extends GridCacheAbstr
     /**
      * @throws Exception if failed.
      */
+    public void testSkipStoreIterator() throws Exception {
+        assertNull(cache().put("1", 100500));
+
+        IgniteCache<String, Integer> c = jcache().withSkipStore();
+
+        Iterator i = c.iterator();
+
+        assertTrue(i.hasNext());
+
+        i.next();
+
+        i.remove();
+
+        i = c.iterator();
+
+        assertFalse(i.hasNext());
+
+        assertNull(c.get("1"));
+
+        assertEquals(100500, map.get("1"));
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testNotSkipStoreIterator() throws Exception {
+        assertNull(cache().put("1", 100500));
+
+        IgniteCache<String, Integer> c = jcache();
+
+        Iterator i = c.iterator();
+
+        assertTrue(i.hasNext());
+
+        i.next();
+
+        i.remove();
+
+        i = c.iterator();
+
+        assertFalse(i.hasNext());
+
+        assertNull(c.get("1"));
+
+        assertNull(map.get("1"));
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
     // TODO: enable when GG-7579 is fixed.
     public void _testSkipStoreFlagMultinode() throws Exception {
         final int nGrids = 3;


Mime
View raw message