#ignite-373: Remove all should check all partitions instead of localPartitions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/be745177 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/be745177 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/be745177 Branch: refs/heads/ignite-373 Commit: be745177f3ab40e94405c8a5e0eb98385511a3ca Parents: f8cdd43 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Tue May 12 14:20:06 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Tue May 12 14:20:06 2015 +0300 ---------------------------------------------------------------------- .../GridDistributedCacheAdapter.java | 60 ++++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be745177/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java index bb7ef1b..5f8b989 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java @@ -315,43 +315,41 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter dataLdr.receiver(DataStreamerCacheUpdaters.<KeyCacheObject, Object>batched()); - for (GridDhtLocalPartition locPart : dht.topology().localPartitions()) { - if (locPart.state() == EVICTED) { - assert locPart.entries().size() == 0; - - continue; - } - - if (locPart == null || locPart.state() != OWNING || !locPart.reserve()) - return false; - - try { - if (!locPart.isEmpty() && locPart.primary(topVer)) { - for (GridDhtCacheEntry o : locPart.entries()) { - if (!ctx.affinity().belongs(ctx.localNode(), locPart.id(), - dht.topology().topologyVersion())) - return false; - - if (!o.obsoleteOrDeleted()) - dataLdr.removeDataInternal(o.key()); + for (int part = 0; part < dht.affinity().partitions(); ++part) { + if (ctx.affinity().belongs(ctx.localNode(), part, topVer)) { + GridDhtLocalPartition locPart = dht.topology().localPartition(part, topVer, false); + + if (locPart == null || locPart.state() != OWNING || !locPart.reserve()) + return false; + + try { + if (!locPart.isEmpty() && locPart.primary(topVer)) { + for (GridDhtCacheEntry o : locPart.entries()) { + if (!ctx.affinity().belongs(ctx.localNode(), locPart.id(), + dht.topology().topologyVersion())) + return false; + + if (!o.obsoleteOrDeleted()) + dataLdr.removeDataInternal(o.key()); + } } - } - GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry>> iter = - ctx.swap().iterator(locPart.id()); + GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry>> iter = + ctx.swap().iterator(locPart.id()); - if (iter != null) { - for (Map.Entry<byte[], GridCacheSwapEntry> e : iter) { - if (!ctx.affinity().belongs(ctx.localNode(), locPart.id(), - dht.topology().topologyVersion())) - return false; + if (iter != null) { + for (Map.Entry<byte[], GridCacheSwapEntry> e : iter) { + if (!ctx.affinity().belongs(ctx.localNode(), locPart.id(), + dht.topology().topologyVersion())) + return false; - dataLdr.removeDataInternal(ctx.toCacheKeyObject(e.getKey())); + dataLdr.removeDataInternal(ctx.toCacheKeyObject(e.getKey())); + } } } - } - finally { - locPart.release(); + finally { + locPart.release(); + } } } }