#ignite-784: small fixes

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/960bd6aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/960bd6aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/960bd6aa

Branch: refs/heads/ignite-784
Commit: 960bd6aa198e02a0ce755a98389b961a63b4ed45
Parents: 784fdec
Author: ivasilinets <ivasilin...@gridgain.com>
Authored: Wed Apr 22 23:14:35 2015 +0300
Committer: ivasilinets <ivasilin...@gridgain.com>
Committed: Wed Apr 22 23:14:35 2015 +0300

----------------------------------------------------------------------
 .../dht/colocated/GridDhtColocatedCache.java    |  2 +-
 .../colocated/GridDhtColocatedLockFuture.java   |  2 +-
 .../distributed/near/GridNearGetFuture.java     | 21 +++++++++++++-------
 .../distributed/near/GridNearLockFuture.java    |  2 +-
 .../near/GridNearTransactionalCache.java        |  2 +-
 5 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/960bd6aa/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 3ca7643..8ad6fd8 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
@@ -529,7 +529,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
                     ClusterNode primary = ctx.affinity().primary(key, topVer);
 
                     if (primary == null) {
-                        log.debug("Filed to unlock key " + key +
+                        log.debug("Failed to unlock key " + key +
                             ". Cannot find primary node for the key.");
 
                         continue;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/960bd6aa/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 61d2e7d..c75b341 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
@@ -1054,7 +1054,7 @@ public final class GridDhtColocatedLockFuture<K, V> 
extends GridCompoundIdentity
 
         if (primary == null || cctx.discovery().node(primary.id()) == null)
             // If primary node left the grid before lock acquisition, fail the 
whole future.
-            throw newTopologyException(null, primary.id());
+            throw newTopologyException(null, primary != null ? primary.id() : 
null);
 
         if (inTx() && tx.groupLock() && !primary.isLocal())
             throw new IgniteCheckedException("Failed to start group lock 
transaction (local node is not primary for " +

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/960bd6aa/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 13836d3..2ee7ef2 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,7 +472,7 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
                         else {
                             primary = cctx.affinity().primary(key, topVer);
 
-                            if (primary == null || !primary.isLocal() &&
+                            if (primary != null && !primary.isLocal() &&
                                 
cctx.cache().configuration().isStatisticsEnabled() && !skipVals)
                                 near.metrics0().onRead(false);
                         }
@@ -511,18 +511,25 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
 
                     savedVers.put(key, nearEntry == null ? null : 
nearEntry.dhtVersion());
 
-                    LinkedHashMap<KeyCacheObject, Boolean> keys = null;
+                    if (primary == null) {
+                        if (remapCnt.incrementAndGet() > MAX_REMAP_CNT) {
+                            onDone(new ClusterTopologyCheckedException("Failed 
to remap key to a new node after " +
+                                MAX_REMAP_CNT + " attempts (key got remapped 
to the same node) " +
+                                "[key=" + key + ", no primary node" + ", 
mappings=" + mapped + ']'));
+
+                            return savedVers;
+                        }
+
+                        break;
+                    }
 
-                    if (primary != null)
-                        mapped.get(primary);
+                    LinkedHashMap<KeyCacheObject, Boolean> keys = 
mapped.get(primary);
 
                     if (keys != null && keys.containsKey(key)) {
                         if (remapCnt.incrementAndGet() > MAX_REMAP_CNT) {
                             onDone(new ClusterTopologyCheckedException("Failed 
to remap key to a new node after " +
                                 MAX_REMAP_CNT + " attempts (key got remapped 
to the same node) " +
-                                "[key=" + key +
-                                primary != null ? ", node=" + 
U.toShortString(primary) : ", no primary node for the key "
-                                + ", mappings=" + mapped + ']'));
+                                "[key=" + key + ", node=" + 
U.toShortString(primary) + ", mappings=" + mapped + ']'));
 
                             return savedVers;
                         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/960bd6aa/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 7bbf7c3..08bc43a 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
@@ -1155,7 +1155,7 @@ public final class GridNearLockFuture<K, V> extends 
GridCompoundIdentityFuture<B
 
         if (primary == null || cctx.discovery().node(primary.id()) == null)
             // If primary node left the grid before lock acquisition, fail the 
whole future.
-            throw newTopologyException(null, primary.id());
+            throw newTopologyException(null, primary != null ? primary.id() : 
null);
 
         if (inTx() && tx.groupLock() && !primary.isLocal())
             throw new IgniteCheckedException("Failed to start group lock 
transaction (local node is not primary for " +

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/960bd6aa/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 3d76715..a363b61 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
@@ -514,7 +514,7 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
                             ClusterNode primary = ctx.affinity().primary(key, 
topVer);
 
                             if (primary == null)
-                                throw new 
ClusterTopologyCheckedException("Filed to unlock key " + key +
+                                throw new 
ClusterTopologyCheckedException("Failed to unlock key " + key +
                                     ". Cannot find primary node for the key " 
+ key + ".");
 
                             GridNearUnlockRequest req = map.get(primary);

Reply via email to