You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/02/13 11:29:59 UTC
[19/40] ignite git commit: ignite-4314 cache.clear should not destroy
offheap map
ignite-4314 cache.clear should not destroy offheap map
(cherry picked from commit 88c06ec)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d396398c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d396398c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d396398c
Branch: refs/heads/ignite-2.0
Commit: d396398c1b4660b3bca24d2650a10f6c0677b4df
Parents: f9aaf03
Author: sboikov <sb...@gridgain.com>
Authored: Fri Dec 2 10:36:41 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jan 19 10:41:10 2017 +0300
----------------------------------------------------------------------
.../cache/GridCacheClearAllRunnable.java | 58 +++++++++-----------
.../processors/cache/GridCacheSwapManager.java | 8 ---
.../cache/transactions/IgniteTxHandler.java | 2 +-
3 files changed, 26 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d396398c/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/d396398c/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 fd0b471..d4499b3 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
@@ -1416,14 +1416,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
}
/**
- * Clears off-heap.
- */
- public void clearOffHeap() {
- if (offheapEnabled)
- initOffHeap();
- }
-
- /**
* Clears swap.
*
* @throws IgniteCheckedException If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d396398c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index f784ba2..d564156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -1507,7 +1507,7 @@ public class IgniteTxHandler {
if (log.isDebugEnabled())
log.debug("Got entry removed exception, will retry: " + entry.txKey());
- entry.cached(null);
+ entry.cached(cacheCtx.cache().entryEx(entry.key(), req.topologyVersion()));
}
}
}