ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: #ignite-286: wip
Date Mon, 27 Apr 2015 10:11:07 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-286 df7a4b603 -> 2460b681e


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

Branch: refs/heads/ignite-286
Commit: 2460b681e3ce95002690bea6897cf789129b187d
Parents: df7a4b6
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Mon Apr 27 13:08:23 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Mon Apr 27 13:08:23 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 16 ++++++++
 .../processors/cache/local/GridLocalCache.java  | 19 +---------
 .../local/atomic/GridLocalAtomicCache.java      | 40 ++++++++++----------
 .../transactions/IgniteTxLocalAdapter.java      | 16 ++++----
 4 files changed, 44 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2460b681/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 c246661..844d711 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
@@ -2715,6 +2715,22 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
     }
 
     /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public void removeAll() throws IgniteCheckedException {
+        assert ctx.isLocal();
+
+        for (Iterator<KeyCacheObject> it = ctx.swap().offHeapKeyIterator(true, true,
AffinityTopologyVersion.NONE);
+             it.hasNext(); )
+            remove((K)it.next().value(ctx.cacheObjectContext(), false));
+
+        for (Iterator<KeyCacheObject> it = ctx.swap().swapKeyIterator(true, true, AffinityTopologyVersion.NONE);
+             it.hasNext(); )
+            remove((K)it.next().value(ctx.cacheObjectContext(), false));
+
+        removeAll(keySet());
+    }
+
+    /** {@inheritDoc} */
     @Override public void removeAll(final Collection<? extends K> keys) throws IgniteCheckedException
{
         boolean statsEnabled = ctx.config().isStatisticsEnabled();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2460b681/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 51fc7e6..6120e25 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
@@ -146,8 +146,7 @@ public class GridLocalCache<K, V> extends GridCacheAdapter<K,
V> {
                     try {
                         entry = entryExx(key);
 
-                        if (ctx.offheapTiered())
-                            entry.unswap(false);
+                        entry.unswap(false);
 
                         if (!ctx.isAll(entry, filter)) {
                             fut.onFailed();
@@ -203,22 +202,6 @@ public class GridLocalCache<K, V> extends GridCacheAdapter<K,
V> {
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public void removeAll() throws IgniteCheckedException {
-        Set<K> keys = new HashSet<>();
-
-        if (ctx.offheapTiered()) {
-            for (Iterator<KeyCacheObject> it = ctx.swap().offHeapKeyIterator(true,
true, AffinityTopologyVersion.NONE);
-                 it.hasNext(); )
-                keys.add((K)it.next().value(ctx.cacheObjectContext(), false));
-        }
-
-        keys.addAll(keySet());
-
-        removeAll(keys);
-    }
-
-    /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> removeAllAsync() {
         return ctx.closures().callLocalSafe(new Callable<Void>() {
             @Override public Void call() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2460b681/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 32aa93e..6ffa061 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
@@ -387,22 +387,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public void removeAll() throws IgniteCheckedException {
-        Set<K> keys = new HashSet<>();
-
-        if (ctx.offheapTiered()) {
-            for (Iterator<KeyCacheObject> it = ctx.swap().offHeapKeyIterator(true,
true, AffinityTopologyVersion.NONE);
-                 it.hasNext(); )
-                keys.add((K)it.next().value(ctx.cacheObjectContext(), false));
-        }
-
-        keys.addAll(keySet());
-
-        removeAll(keys);
-    }
-
-    /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> removeAllAsync() {
         return ctx.closures().callLocalSafe(new Callable<Void>() {
             @Override public Void call() throws Exception {
@@ -1383,18 +1367,25 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
      */
     private List<GridCacheEntryEx> lockEntries(Collection<? extends K> keys)
{
         List<GridCacheEntryEx> locked = new ArrayList<>(keys.size());
-        for (K key : keys) {
-            if (key == null)
-                throw new NullPointerException("Null key.");
-        }
+
+        boolean nullKeys = false;
 
         while (true) {
             for (K key : keys) {
+                if (key == null) {
+                    nullKeys = true;
+
+                    break;
+                }
+
                 GridCacheEntryEx entry = entryEx(ctx.toCacheKeyObject(key));
 
                 locked.add(entry);
             }
 
+            if (nullKeys)
+                break;
+
             for (int i = 0; i < locked.size(); i++) {
                 GridCacheEntryEx entry = locked.get(i);
 
@@ -1416,6 +1407,15 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
             if (!locked.isEmpty())
                 return locked;
         }
+
+        assert nullKeys;
+
+        AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
+
+        for (GridCacheEntryEx entry : locked)
+            ctx.evicts().touch(entry, topVer);
+
+        throw new NullPointerException("Null keys");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2460b681/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 7a3292c..a278d63 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
@@ -2018,14 +2018,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         assert cached == null || keys.size() == 1;
         assert cached == null || F.first(keys).equals(cached.key());
 
-        for (Object key : keys) {
-            if (key == null) {
-                setRollbackOnly();
-
-                throw new NullPointerException("Null key.");
-            }
-        }
-
         try {
             addActiveCache(cacheCtx);
         }
@@ -2047,6 +2039,12 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
             groupLockSanityCheck(cacheCtx, keys);
 
             for (Object key : keys) {
+                if (key == null) {
+                    rollback();
+
+                    throw new NullPointerException("Null key.");
+                }
+
                 Object val = rmv || lookup == null ? null : lookup.get(key);
                 EntryProcessor entryProcessor = invokeMap == null ? null : invokeMap.get(key);
 
@@ -2193,7 +2191,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                 drVer,
                                 skipStore);
 
-                            if (!implicit() && readCommitted() && op != DELETE)
+                            if (!implicit() && readCommitted() && !cacheCtx.offheapTiered())
                                 cacheCtx.evicts().touch(entry, topologyVersion());
 
                             if (groupLock() && !lockOnly)


Mime
View raw message