Repository: incubator-ignite Updated Branches: refs/heads/ignite-784 2367f157b -> 3924c26c1
# ignite-784 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3924c26c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3924c26c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3924c26c Branch: refs/heads/ignite-784 Commit: 3924c26c11c13429a9c240237f6561885efe8895 Parents: 2367f15 Author: sboikov <sboi...@gridgain.com> Authored: Fri Apr 24 09:24:18 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Fri Apr 24 09:24:18 2015 +0300 ---------------------------------------------------------------------- .../dht/GridPartitionedGetFuture.java | 18 ++++++++--------- .../dht/colocated/GridDhtColocatedCache.java | 11 ++++++---- .../colocated/GridDhtColocatedLockFuture.java | 2 +- .../distributed/near/GridNearGetFuture.java | 21 +++++++++++++------- .../distributed/near/GridNearLockFuture.java | 2 +- .../near/GridNearTransactionalCache.java | 16 +++++++-------- 6 files changed, 40 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3924c26c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java index d675996..35ba2a9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java @@ -419,15 +419,6 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M GridCacheEntryEx entry = null; try { - ClusterNode node = cctx.affinity().primary(key, topVer); - - if (node == null) { - onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + - "(all partition nodes left the grid).")); - - return false; - } - if (!reload && allowLocRead) { try { entry = colocated.context().isSwapOrOffheapEnabled() ? colocated.entryEx(key) : @@ -469,6 +460,15 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M } } + ClusterNode node = cctx.affinity().primary(key, topVer); + + if (node == null) { + onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + + "(all partition nodes left the grid).")); + + return false; + } + remote = !node.isLocal(); LinkedHashMap<KeyCacheObject, Boolean> keys = mapped.get(node); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3924c26c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java index b415b96..c92d9ce 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java @@ -418,9 +418,12 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte // Send request to remove from remote nodes. ClusterNode primary = ctx.affinity().primary(key, topVer); - if (primary == null) - new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + - "(all partition nodes left the grid)."); + if (primary == null) { + if (log.isDebugEnabled()) + log.debug("Failed to unlock keys (all partition nodes left the grid)."); + + continue; + } if (map == null) { Collection<ClusterNode> affNodes = CU.allNodes(ctx, topVer); @@ -534,7 +537,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte if (primary == null) { if (log.isDebugEnabled()) - log.debug("Failed to map keys for cache (all partition nodes left the grid)."); + log.debug("Failed to remove locks (all partition nodes left the grid)."); continue; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3924c26c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java index 24239e3..5b74b31 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java @@ -1081,7 +1081,7 @@ public final class GridDhtColocatedLockFuture<K, V> extends GridCompoundIdentity ClusterNode primary = cctx.affinity().primary(key, topVer); if (primary == null) - new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + + throw new ClusterTopologyServerNotFoundException("Failed to lock keys " + "(all partition nodes left the grid)."); if (cctx.discovery().node(primary.id()) == null) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3924c26c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java index e13660f..fc178e3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java @@ -472,8 +472,14 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma else { primary = cctx.affinity().primary(key, topVer); - if (primary != null && !primary.isLocal() && - cctx.cache().configuration().isStatisticsEnabled() && !skipVals) + if (primary == null) { + onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + + "(all partition nodes left the grid).")); + + return savedVers; + } + + if (!primary.isLocal() && cctx.cache().configuration().isStatisticsEnabled() && !skipVals) near.metrics0().onRead(false); } } @@ -499,14 +505,15 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0))); } else { - if (primary == null) + if (primary == null) { primary = cctx.affinity().primary(key, topVer); - if (primary == null) { - onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + - "(all partition nodes left the grid).")); + if (primary == null) { + onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + + "(all partition nodes left the grid).")); - return savedVers; + return savedVers; + } } GridNearCacheEntry nearEntry = allowLocRead ? near.peekExx(key) : null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3924c26c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java index f425e1b..a427b65 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java @@ -1181,7 +1181,7 @@ public final class GridNearLockFuture<K, V> extends GridCompoundIdentityFuture<B ClusterNode primary = cctx.affinity().primary(key, topVer); if (primary == null) - new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + + throw new ClusterTopologyServerNotFoundException("Failed to lock keys " + "(all partition nodes left the grid)."); if (cctx.discovery().node(primary.id()) == null) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3924c26c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java index a042244..581c7e0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java @@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.affinity.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; @@ -526,9 +525,12 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V> // Send request to remove from remote nodes. ClusterNode primary = ctx.affinity().primary(key, topVer); - if (primary == null) - throw new ClusterTopologyCheckedException("Failed to unlock key " + key + - ". Cannot find primary node for the key " + key + "."); + if (primary == null) { + if (log.isDebugEnabled()) + log.debug("Failed to unlock key (all partition nodes left the grid)."); + + break; + } GridNearUnlockRequest req = map.get(primary); @@ -646,7 +648,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V> if (primary == null) { if (log.isDebugEnabled()) - log.debug("Failed to map keys for cache (all partition nodes left the grid)."); + log.debug("Failed to unlock key (all partition nodes left the grid)."); break; } @@ -671,9 +673,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V> continue; } - req.addKey( - entry.key(), - ctx); + req.addKey(entry.key(), ctx); } } }