# IGNITE-54-55 Minor changes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4ebc46f5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4ebc46f5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4ebc46f5 Branch: refs/heads/ignite-57 Commit: 4ebc46f59eccdf08656c098bb28ce7aa6433a844 Parents: f6fa027 Author: sevdokimov <[email protected]> Authored: Tue Feb 3 16:51:19 2015 +0300 Committer: sevdokimov <[email protected]> Committed: Tue Feb 3 16:51:19 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheAdapter.java | 20 ++++++++++---------- .../cache/GridCacheAbstractSelfTest.java | 3 +-- ...ePartitionedMultiThreadedPutGetSelfTest.java | 5 ++++- 3 files changed, 15 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ebc46f5/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 3271a5b..e4d3fa0 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 @@ -3400,14 +3400,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, // Send job to all nodes. Collection<ClusterNode> nodes = ctx.grid().forCacheNodes(name()).nodes(); - IgniteInternalFuture<Object> fut = null; - - if (!nodes.isEmpty()) - fut = ctx.closures().callAsyncNoFailover(BROADCAST, new GlobalRemoveAllCallable<>(name(), topVer, REMOVE_ALL_BATCH_SIZE), nodes, true); - - if (fut != null) - fut.get(); - + if (!nodes.isEmpty()) { + ctx.closures().callAsyncNoFailover(BROADCAST, + new GlobalRemoveAllCallable<>(name(), topVer, REMOVE_ALL_BATCH_SIZE), nodes, true).get(); + } } while (ctx.affinity().affinityTopologyVersion() > topVer); } catch (ClusterGroupEmptyException ignore) { @@ -5236,7 +5232,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, * @param cacheName Cache name. * @param topVer Topology version. * @param rmvBatchSz Remove batch size. - * @param filter Filter. */ private GlobalRemoveAllCallable(String cacheName, long topVer, long rmvBatchSz) { this.cacheName = cacheName; @@ -5248,7 +5243,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, * {@inheritDoc} */ @Override public Object call() throws Exception { - Set<K> keys = new HashSet<>(); + Collection<K> keys = new ArrayList<>(); final IgniteKernal grid = (IgniteKernal) ignite; @@ -5256,17 +5251,22 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, final GridCacheContext<K, V> ctx = grid.context().cache().<K, V>internalCache(cacheName).context(); + if (ctx.affinity().affinityTopologyVersion() != topVer) + return null; // Ignore this remove request because remove request will be sent again. + assert cache != null; for (K k : cache.keySet()) { if (ctx.affinity().primary(ctx.localNode(), k, topVer)) keys.add(k); + if (keys.size() >= rmvBatchSz) { cache.removeAll(keys); keys.clear(); } } + cache.removeAll(keys); return null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ebc46f5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java index d0cdfa1..f0932af 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java @@ -124,9 +124,8 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest { // removeAll() removes mapping only when it presents at a primary node. // To remove all mappings used force remove by key. if (cache.size() > 0) { - for (Object k : cache.keySet()) { + for (Object k : cache.keySet()) cache.remove(k); - } } if (offheapTiered(cache)) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ebc46f5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java index 8ca1b93..dffb359 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java @@ -101,8 +101,11 @@ public class GridCachePartitionedMultiThreadedPutGetSelfTest extends GridCommonA @Override protected void afterTest() throws Exception { super.afterTest(); + if (GRID_CNT > 0) + grid(0).cache(null).removeAll(); + for (int i = 0; i < GRID_CNT; i++) { - grid(i).cache(null).removeAll(); + grid(0).cache(null).clearLocally(); assert grid(i).cache(null).isEmpty(); }
