You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/10/13 09:25:13 UTC
[08/18] ignite git commit: 1. fixed DhtInvalidPartitionException with
force keys request. 2. added proper message to DhtInvalidPartitionException
instantiations.
1. fixed DhtInvalidPartitionException with force keys request.
2. added proper message to DhtInvalidPartitionException instantiations.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e3d1b11
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e3d1b11
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e3d1b11
Branch: refs/heads/ignite-1537
Commit: 6e3d1b11b409a966a351875661e43f48320da3fe
Parents: 93aabaa
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Oct 5 10:59:41 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Oct 5 10:59:41 2015 +0300
----------------------------------------------------------------------
.../dht/GridClientPartitionTopology.java | 13 +++++++++----
.../distributed/dht/GridDhtLocalPartition.java | 3 ++-
.../dht/GridDhtPartitionTopologyImpl.java | 12 +++++++-----
.../dht/preloader/GridDhtPreloader.java | 18 +++++++++++++++---
.../near/GridCacheNearTxForceKeyTest.java | 2 +-
5 files changed, 34 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3d1b11/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 5e3cc0b..162c116 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -313,13 +313,18 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Nullable @Override public GridDhtLocalPartition localPartition(int p, AffinityTopologyVersion topVer, boolean create)
+ @Nullable @Override public GridDhtLocalPartition localPartition(
+ int p,
+ AffinityTopologyVersion topVer,
+ boolean create
+ )
throws GridDhtInvalidPartitionException {
if (!create)
return null;
- throw new GridDhtInvalidPartitionException(p, "Adding entry to evicted partition [part=" + p +
- ", topVer=" + topVer + ", this.topVer=" + this.topVer + ']');
+ throw new GridDhtInvalidPartitionException(p, "Adding entry to evicted partition (often may be caused by " +
+ "inconsistent 'key.hashCode()' implementation) " +
+ "[part=" + p + ", topVer=" + topVer + ", this.topVer=" + this.topVer + ']');
}
/** {@inheritDoc} */
@@ -912,4 +917,4 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3d1b11/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 2deabfe..4f124e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -258,7 +258,8 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
GridDhtPartitionState state = state();
if (state == EVICTED)
- throw new GridDhtInvalidPartitionException(id, "Adding entry to invalid partition [part=" + id + ']');
+ throw new GridDhtInvalidPartitionException(id, "Adding entry to invalid partition " +
+ "(often may be caused by inconsistent 'key.hashCode()' implementation) [part=" + id + ']');
map.put(entry.key(), entry);
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3d1b11/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index a0c9c88..6bd283a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -563,16 +563,18 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
return null;
if (!belongs)
- throw new GridDhtInvalidPartitionException(p, "Adding entry to evicted partition [part=" + p +
- ", topVer=" + topVer + ", this.topVer=" + this.topVer + ']');
+ throw new GridDhtInvalidPartitionException(p, "Adding entry to evicted partition " +
+ "(often may be caused by inconsistent 'key.hashCode()' implementation) " +
+ "[part=" + p + ", topVer=" + topVer + ", this.topVer=" + this.topVer + ']');
continue;
}
if (loc == null && create) {
if (!belongs)
- throw new GridDhtInvalidPartitionException(p, "Creating partition which does not belong [part=" +
- p + ", topVer=" + topVer + ", this.topVer=" + this.topVer + ']');
+ throw new GridDhtInvalidPartitionException(p, "Creating partition which does not belong to " +
+ "local node (often may be caused by inconsistent 'key.hashCode()' implementation) " +
+ "[part=" + p + ", topVer=" + topVer + ", this.topVer=" + this.topVer + ']');
lock.writeLock().lock();
@@ -1324,4 +1326,4 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3d1b11/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 36c80a9..67985a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -42,6 +42,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffini
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.util.GridAtomicLong;
@@ -373,10 +374,13 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
GridDhtLocalPartition locPart = top.localPartition(p, AffinityTopologyVersion.NONE, false);
// If this node is no longer an owner.
- if (locPart == null && !top.owners(p).contains(loc))
+ if (locPart == null && !top.owners(p).contains(loc)) {
res.addMissed(k);
- GridCacheEntryEx entry;
+ continue;
+ }
+
+ GridCacheEntryEx entry = null;
if (cctx.isSwapOrOffheapEnabled()) {
while (true) {
@@ -391,6 +395,14 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
if (log.isDebugEnabled())
log.debug("Got removed entry: " + k);
}
+ catch (GridDhtInvalidPartitionException ignore) {
+ if (log.isDebugEnabled())
+ log.debug("Local node is no longer an owner: " + p);
+
+ res.addMissed(k);
+
+ break;
+ }
}
}
else
@@ -619,4 +631,4 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
*/
protected abstract void onMessage(ClusterNode node, M msg);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3d1b11/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
index 6d8c190..348597e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
@@ -76,4 +76,4 @@ public class GridCacheNearTxForceKeyTest extends GridCommonAbstractTest {
assertTrue(ignite0.affinity(null).isPrimary(ignite1.cluster().localNode(), key));
}
-}
\ No newline at end of file
+}