#ignite-333: Remove from swap on clearLocally.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/42b32947 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/42b32947 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/42b32947 Branch: refs/heads/ignite-gg-9858 Commit: 42b32947cf0b7b859d16c5a0eabb4c7315780e3a Parents: b12945a Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Mar 13 15:26:12 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Mar 13 15:26:12 2015 +0300 ---------------------------------------------------------------------- .../internal/processors/cache/GridCacheAdapter.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/42b32947/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 a998c2c..2f68e58 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 @@ -1398,9 +1398,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, try { if (e != null) e.clear(obsoleteVer, readers, null); - - if (ctx.isSwapOrOffheapEnabled()) - entryEx(ctx.toCacheKeyObject(key)).clear(ctx.versions().next(), false, CU.empty0()); } catch (IgniteCheckedException ex) { U.error(log, "Failed to clearLocally entry (will continue to clearLocally other entries): " + e, @@ -1424,10 +1421,14 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, GridCacheEntryEx e = peekEx(cacheKey); - if (ctx.isSwapOrOffheapEnabled()) - entryEx(ctx.toCacheKeyObject(key)).clear(ctx.versions().next(), false, CU.empty0()); + boolean removed = true; + + if (!ctx.isNear() && ctx.isSwapOrOffheapEnabled() && ctx.swap().containsKey(ctx.toCacheKeyObject(key))) + removed = entryEx(ctx.toCacheKeyObject(key)).clear(obsoleteVer, false, CU.empty0()); + + removed &= e != null && e.clear(obsoleteVer, false, filter); - return e != null && e.clear(obsoleteVer, false, filter); + return removed; } catch (IgniteCheckedException ex) { U.error(log, "Failed to clearLocally entry for key: " + key, ex);