You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/12/01 08:42:32 UTC

ignite git commit: ignite-4314 cache.clear should not destroy offheap map

Repository: ignite
Updated Branches:
  refs/heads/ignite-4314 [created] 3fdb1d6ac


ignite-4314 cache.clear should not destroy offheap map


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

Branch: refs/heads/ignite-4314
Commit: 3fdb1d6ac4d2c04ebabe6000a85b2f5ca3711864
Parents: 59c3ee8
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 1 11:40:31 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 1 11:40:31 2016 +0300

----------------------------------------------------------------------
 .../cache/GridCacheClearAllRunnable.java        | 58 +++++++++-----------
 .../processors/cache/GridCacheSwapManager.java  |  8 ---
 2 files changed, 25 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3fdb1d6a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
index 4f97e7b..9e7f329 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
@@ -87,48 +87,40 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
         // Clear swapped entries.
         if (!ctx.isNear()) {
             if (ctx.swap().offHeapEnabled()) {
-                if (GridQueryProcessor.isEnabled(ctx.config())) {
-                    for (Iterator<KeyCacheObject> it =
-                        ctx.swap().offHeapKeyIterator(true, true, AffinityTopologyVersion.NONE); it.hasNext();) {
-                        KeyCacheObject key = it.next();
-
-                        if (owns(key))
-                            clearEntry(cache.entryEx(key));
+                for (Iterator<KeyCacheObject> it = ctx.swap().offHeapKeyIterator(true, true, AffinityTopologyVersion.NONE); it.hasNext();) {
+                    KeyCacheObject key = it.next();
 
-                    }
+                    if (owns(key))
+                        clearEntry(cache.entryEx(key));
                 }
-                else if (id == 0)
-                    ctx.swap().clearOffHeap();
             }
 
-            if (ctx.isSwapOrOffheapEnabled()) {
-                if (ctx.swap().swapEnabled()) {
-                    if (GridQueryProcessor.isEnabled(ctx.config())) {
-                        Iterator<KeyCacheObject> it = null;
+            if (ctx.swap().swapEnabled()) {
+                if (GridQueryProcessor.isEnabled(ctx.config())) {
+                    Iterator<KeyCacheObject> it = null;
 
-                        try {
-                            it = ctx.swap().swapKeyIterator(true, true, AffinityTopologyVersion.NONE);
-                        }
-                        catch (IgniteCheckedException e) {
-                            U.error(log, "Failed to get iterator over swap.", e);
-                        }
+                    try {
+                        it = ctx.swap().swapKeyIterator(true, true, AffinityTopologyVersion.NONE);
+                    }
+                    catch (IgniteCheckedException e) {
+                        U.error(log, "Failed to get iterator over swap.", e);
+                    }
 
-                        if (it != null) {
-                            while (it.hasNext()) {
-                                KeyCacheObject key = it.next();
+                    if (it != null) {
+                        while (it.hasNext()) {
+                            KeyCacheObject key = it.next();
 
-                                if (owns(key))
-                                    clearEntry(cache.entryEx(key));
-                            }
+                            if (owns(key))
+                                clearEntry(cache.entryEx(key));
                         }
                     }
-                    else if (id == 0) {
-                        try {
-                            ctx.swap().clearSwap();
-                        }
-                        catch (IgniteCheckedException e) {
-                            U.error(log, "Failed to clearLocally entries from swap storage.", e);
-                        }
+                }
+                else if (id == 0) {
+                    try {
+                        ctx.swap().clearSwap();
+                    }
+                    catch (IgniteCheckedException e) {
+                        U.error(log, "Failed to clearLocally entries from swap storage.", e);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3fdb1d6a/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 5ada8dc..2509b88 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
@@ -1430,14 +1430,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     }
 
     /**
-     * Clears off-heap.
-     */
-    public void clearOffHeap() {
-        if (offheapEnabled)
-            initOffHeap();
-    }
-
-    /**
      * Clears swap.
      *
      * @throws IgniteCheckedException If failed.