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/11/17 14:28:46 UTC
[1/3] ignite git commit: ignite-1923
testResponseMessageOnRequestUnmarshallingFailed fixed
Repository: ignite
Updated Branches:
refs/heads/ignite-1913 3fe6cce3e -> d10fe91ed
ignite-1923 testResponseMessageOnRequestUnmarshallingFailed fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6ecc482
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6ecc482
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6ecc482
Branch: refs/heads/ignite-1913
Commit: f6ecc4820e3c30c844769abb67ec00997a1ca70e
Parents: 3a8c19e
Author: agura <ag...@gridgain.com>
Authored: Mon Nov 16 16:05:22 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Tue Nov 17 14:26:32 2015 +0300
----------------------------------------------------------------------
.../cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ecc482/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
index 07fa2bc..79e9801 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache;
import java.io.IOException;
import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import javax.cache.CacheException;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SqlQuery;
@@ -64,8 +65,6 @@ public class IgniteCacheP2pUnmarshallingQueryErrorTest extends IgniteCacheP2pUnm
public void testResponseMessageOnRequestUnmarshallingFailed() throws Exception {
readCnt.set(Integer.MAX_VALUE);
- jcache(0).put(new TestKey(String.valueOf(++key)), "");
-
try {
jcache().query(new ScanQuery<>(new IgniteBiPredicate<TestKey, String>() {
@Override public boolean apply(TestKey key, String val) {
@@ -75,6 +74,10 @@ public class IgniteCacheP2pUnmarshallingQueryErrorTest extends IgniteCacheP2pUnm
private void readObject(ObjectInputStream is) throws IOException {
throw new IOException();
}
+
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ throw new IOException();
+ }
})).getAll();
fail("Request unmarshalling failed, but error response was not sent.");
[3/3] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-1913
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-1913
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d10fe91e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d10fe91e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d10fe91e
Branch: refs/heads/ignite-1913
Commit: d10fe91ed3b438c05344577411b6fccdb90cd5fa
Parents: afd55d9 f6ecc48
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 17 16:27:03 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 17 16:27:03 2015 +0300
----------------------------------------------------------------------
.../cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[2/3] ignite git commit: Ignite-1913
Posted by sb...@apache.org.
Ignite-1913
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/afd55d9f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/afd55d9f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/afd55d9f
Branch: refs/heads/ignite-1913
Commit: afd55d9f62f310d1ffdcd1403c1a9a636ce36fb4
Parents: 3fe6cce
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 17 16:26:12 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 17 16:26:12 2015 +0300
----------------------------------------------------------------------
.../internal/MarshallerContextAdapter.java | 4 +-
.../GridCachePartitionExchangeManager.java | 86 ++----
.../dht/GridClientPartitionTopology.java | 38 +--
.../dht/GridDhtPartitionTopology.java | 12 +-
.../dht/GridDhtPartitionTopologyImpl.java | 45 +--
.../dht/preloader/GridDhtPartitionFullMap.java | 41 ++-
.../dht/preloader/GridDhtPartitionMap.java | 148 +---------
.../dht/preloader/GridDhtPartitionMap2.java | 295 +++++++++++++++++++
.../GridDhtPartitionsExchangeFuture.java | 33 ++-
.../GridDhtPartitionsSingleMessage.java | 31 +-
.../ignite/internal/visor/cache/VisorCache.java | 6 +-
.../resources/META-INF/classnames.properties | 1 +
.../dht/GridCacheDhtPreloadDelayedSelfTest.java | 12 +-
.../dht/GridCacheDhtPreloadSelfTest.java | 4 +-
.../distributed/dht/GridCacheDhtTestUtils.java | 8 +-
.../h2/twostep/GridReduceQueryExecutor.java | 4 +-
.../cache/WaitMapExchangeFinishCallable.java | 4 +-
.../IgniteFailoverAbstractBenchmark.java | 4 +-
18 files changed, 468 insertions(+), 308 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
index c25da03..ad34393 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
@@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentMap;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.plugin.PluginProvider;
@@ -86,7 +86,7 @@ public abstract class MarshallerContextAdapter implements MarshallerContext {
processResource(jdkClsNames);
checkHasClassName(GridDhtPartitionFullMap.class.getName(), ldr, CLS_NAMES_FILE);
- checkHasClassName(GridDhtPartitionMap.class.getName(), ldr, CLS_NAMES_FILE);
+ checkHasClassName(GridDhtPartitionMap2.class.getName(), ldr, CLS_NAMES_FILE);
checkHasClassName(HashMap.class.getName(), ldr, JDK_CLS_NAMES_FILE);
if (plugins != null && !plugins.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index f93c40f..e99844b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -55,6 +55,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
@@ -713,35 +714,26 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
* @return {@code True} if message was sent, {@code false} if node left grid.
*/
private boolean sendAllPartitions(Collection<? extends ClusterNode> nodes) {
- boolean retry = false;
+ GridDhtPartitionsFullMessage m = new GridDhtPartitionsFullMessage(null, null, AffinityTopologyVersion.NONE);
- GridDhtPartitionsFullMessage m;
+ boolean useOldApi = false;
- do {
- AffinityTopologyVersion topVer = cctx.exchange().topologyVersion();
-
- m = new GridDhtPartitionsFullMessage(null, null, topVer);
-
- for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
- cacheCtx.topology().readLock();
-
- try {
- if (!cacheCtx.topology().topologyVersion().equals(topVer)) {
- retry = true;
-
- break;
- }
+ for (ClusterNode node : nodes) {
+ if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
+ useOldApi = true;
+ }
- if (!cacheCtx.isLocal() && cacheCtx.started())
- m.addFullPartitionsMap(cacheCtx.cacheId(), cacheCtx.topology().partitionMap(true));
+ for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
+ if (!cacheCtx.isLocal() && cacheCtx.started()) {
+ GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
+ if (useOldApi) {
+ locMap = new GridDhtPartitionFullMap(locMap.nodeId(), locMap.nodeOrder(), locMap.updateSequence(), locMap);
}
- finally {
- cacheCtx.topology().readUnlock();
- }
+
+ m.addFullPartitionsMap(cacheCtx.cacheId(), locMap);
}
}
- while (retry);
// It is important that client topologies be added after contexts.
for (GridClientPartitionTopology top : cctx.exchange().clientTopologies())
@@ -772,41 +764,23 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
* @param id ID.
*/
private void sendLocalPartitions(ClusterNode node, @Nullable GridDhtPartitionExchangeId id) {
- boolean retry = false;
-
- GridDhtPartitionsSingleMessage m;
-
- do {
- AffinityTopologyVersion topVer = cctx.exchange().topologyVersion();
+ GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(id,
+ cctx.kernalContext().clientNode(),
+ cctx.versions().last());
- m = new GridDhtPartitionsSingleMessage(id,
- cctx.kernalContext().clientNode(),
- cctx.versions().last(),
- topVer);
-
- for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
- if (!cacheCtx.isLocal()) {
- cacheCtx.topology().readLock();
-
- try {
- if (!cacheCtx.topology().topologyVersion().equals(topVer)) {
- retry = true;
+ for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
+ if (!cacheCtx.isLocal()) {
+ GridDhtPartitionMap2 locMap = cacheCtx.topology().localPartitionMap();
- break;
- }
+ if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
+ locMap = new GridDhtPartitionMap(locMap.nodeId(), locMap.updateSequence(), locMap.map());
- m.addLocalPartitionMap(cacheCtx.cacheId(), cacheCtx.topology().localPartitionMap());
- }
- finally {
- cacheCtx.topology().readUnlock();
- }
- }
+ m.addLocalPartitionMap(cacheCtx.cacheId(), locMap);
}
}
- while (retry);
for (GridClientPartitionTopology top : clientTops.values()) {
- GridDhtPartitionMap locMap = top.localPartitionMap();
+ GridDhtPartitionMap2 locMap = top.localPartitionMap();
m.addLocalPartitionMap(top.cacheId(), locMap);
}
@@ -969,11 +943,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
- if (cacheCtx != null && cacheCtx.startTopologyVersion() != null &&
- msg.topologyVersion() != AffinityTopologyVersion.NONE && // Backward compatibility.
- cacheCtx.startTopologyVersion().compareTo(msg.topologyVersion()) > 0)
- continue;
-
if (cacheCtx != null && !cacheCtx.started())
continue; // Can safely ignore background exchange.
@@ -1015,14 +984,15 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
boolean updated = false;
- for (Map.Entry<Integer, GridDhtPartitionMap> entry : msg.partitions().entrySet()) {
+ for (Map.Entry<Integer, GridDhtPartitionMap2> entry : msg.partitions().entrySet()) {
Integer cacheId = entry.getKey();
GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
if (cacheCtx != null && cacheCtx.startTopologyVersion() != null &&
- msg.topologyVersion() != AffinityTopologyVersion.NONE && // Backward compatibility.
- cacheCtx.startTopologyVersion().compareTo(msg.topologyVersion()) > 0)
+ entry.getValue() != null &&
+ entry.getValue().topologyVersion() != null && // Backward compatibility.
+ cacheCtx.startTopologyVersion().compareTo(entry.getValue().topologyVersion()) > 0)
continue;
GridDhtPartitionTopology top = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/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 162c116..c8f3eb9 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
@@ -35,7 +35,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.GridAtomicLong;
@@ -134,7 +134,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
* @return Full map string representation.
*/
@SuppressWarnings( {"ConstantConditions"})
- private String mapString(GridDhtPartitionMap map) {
+ private String mapString(GridDhtPartitionMap2 map) {
return map == null ? "null" : FULL_MAP_DEBUG ? map.toFullString() : map.toString();
}
@@ -355,11 +355,11 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public GridDhtPartitionMap localPartitionMap() {
+ @Override public GridDhtPartitionMap2 localPartitionMap() {
lock.readLock().lock();
try {
- return new GridDhtPartitionMap(cctx.localNodeId(), updateSeq.get(),
+ return new GridDhtPartitionMap2(cctx.localNodeId(), updateSeq.get(), topVer,
Collections.<Integer, GridDhtPartitionState>emptyMap(), true);
}
finally {
@@ -372,7 +372,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
lock.readLock().lock();
try {
- GridDhtPartitionMap partMap = node2part.get(nodeId);
+ GridDhtPartitionMap2 partMap = node2part.get(nodeId);
if (partMap != null) {
GridDhtPartitionState state = partMap.get(part);
@@ -526,7 +526,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId,
+ @Nullable @Override public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
GridDhtPartitionFullMap partMap) {
if (log.isDebugEnabled())
log.debug("Updating full partition map [exchId=" + exchId + ", parts=" + fullMapString() + ']');
@@ -556,8 +556,8 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
lastExchangeId = exchId;
if (node2part != null) {
- for (GridDhtPartitionMap part : node2part.values()) {
- GridDhtPartitionMap newPart = partMap.get(part.nodeId());
+ for (GridDhtPartitionMap2 part : node2part.values()) {
+ GridDhtPartitionMap2 newPart = partMap.get(part.nodeId());
// If for some nodes current partition has a newer map,
// then we keep the newer value.
@@ -587,7 +587,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
Map<Integer, Set<UUID>> p2n = new HashMap<>();
- for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : partMap.entrySet()) {
for (Integer p : e.getValue().keySet()) {
Set<UUID> ids = p2n.get(p);
@@ -616,8 +616,8 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId,
- GridDhtPartitionMap parts) {
+ @Nullable @Override public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
+ GridDhtPartitionMap2 parts) {
if (log.isDebugEnabled())
log.debug("Updating single partition map [exchId=" + exchId + ", parts=" + mapString(parts) + ']');
@@ -653,7 +653,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
node2part = new GridDhtPartitionFullMap();
}
- GridDhtPartitionMap cur = node2part.get(parts.nodeId());
+ GridDhtPartitionMap2 cur = node2part.get(parts.nodeId());
if (cur != null && cur.updateSequence() >= parts.updateSequence()) {
if (log.isDebugEnabled())
@@ -749,10 +749,10 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
}
- GridDhtPartitionMap map = node2part.get(nodeId);
+ GridDhtPartitionMap2 map = node2part.get(nodeId);
if (map == null)
- node2part.put(nodeId, map = new GridDhtPartitionMap(nodeId, updateSeq,
+ node2part.put(nodeId, map = new GridDhtPartitionMap2(nodeId, updateSeq, topVer,
Collections.<Integer, GridDhtPartitionState>emptyMap(), false));
map.updateSequence(updateSeq);
@@ -790,7 +790,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
part2node = new HashMap<>(part2node);
- GridDhtPartitionMap parts = node2part.remove(nodeId);
+ GridDhtPartitionMap2 parts = node2part.remove(nodeId);
if (parts != null) {
for (Integer p : parts.keySet()) {
@@ -840,7 +840,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Nullable @Override public GridDhtPartitionMap partitions(UUID nodeId) {
+ @Nullable @Override public GridDhtPartitionMap2 partitions(UUID nodeId) {
lock.readLock().lock();
try {
@@ -868,7 +868,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
if (nodeId == null)
return false;
- GridDhtPartitionMap parts = node2part.get(nodeId);
+ GridDhtPartitionMap2 parts = node2part.get(nodeId);
// Set can be null if node has been removed.
if (parts != null) {
@@ -896,7 +896,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
if (node2part == null)
return;
- for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : node2part.entrySet()) {
for (Integer p : e.getValue().keySet()) {
Set<UUID> nodeIds = part2node.get(p);
@@ -908,7 +908,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
for (Map.Entry<Integer, Set<UUID>> e : part2node.entrySet()) {
for (UUID nodeId : e.getValue()) {
- GridDhtPartitionMap map = node2part.get(nodeId);
+ GridDhtPartitionMap2 map = node2part.get(nodeId);
assert map != null : "Failed consistency check [part=" + e.getKey() + ", nodeId=" + nodeId + ']';
assert map.containsKey(e.getKey()) : "Failed consistency check [part=" + e.getKey() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index d642314..18fb154 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.jetbrains.annotations.Nullable;
@@ -132,7 +132,7 @@ public interface GridDhtPartitionTopology {
/**
* @return Local IDs.
*/
- public GridDhtPartitionMap localPartitionMap();
+ public GridDhtPartitionMap2 localPartitionMap();
/**
* @param nodeId Node ID.
@@ -195,15 +195,15 @@ public interface GridDhtPartitionTopology {
* @param partMap Update partition map.
* @return Local partition map if there were evictions or {@code null} otherwise.
*/
- public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId, GridDhtPartitionFullMap partMap);
+ public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId, GridDhtPartitionFullMap partMap);
/**
* @param exchId Exchange ID.
* @param parts Partitions.
* @return Local partition map if there were evictions or {@code null} otherwise.
*/
- @Nullable public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId,
- GridDhtPartitionMap parts);
+ @Nullable public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
+ GridDhtPartitionMap2 parts);
/**
* @param part Partition to own.
@@ -220,7 +220,7 @@ public interface GridDhtPartitionTopology {
* @param nodeId Node to get partitions for.
* @return Partitions for node.
*/
- @Nullable public GridDhtPartitionMap partitions(UUID nodeId);
+ @Nullable public GridDhtPartitionMap2 partitions(UUID nodeId);
/**
* Prints memory stats.
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/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 6bd283a..320e184 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
@@ -39,7 +39,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.GridAtomicLong;
@@ -150,7 +150,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
* @return Full map string representation.
*/
@SuppressWarnings( {"ConstantConditions"})
- private String mapString(GridDhtPartitionMap map) {
+ private String mapString(GridDhtPartitionMap2 map) {
return map == null ? "null" : FULL_MAP_DEBUG ? map.toFullString() : map.toString();
}
@@ -650,11 +650,11 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public GridDhtPartitionMap localPartitionMap() {
+ @Override public GridDhtPartitionMap2 localPartitionMap() {
lock.readLock().lock();
try {
- return new GridDhtPartitionMap(cctx.nodeId(), updateSeq.get(),
+ return new GridDhtPartitionMap2(cctx.nodeId(), updateSeq.get(), topVer,
F.viewReadOnly(locParts, CU.part2state()), true);
}
finally {
@@ -667,7 +667,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
lock.readLock().lock();
try {
- GridDhtPartitionMap partMap = node2part.get(nodeId);
+ GridDhtPartitionMap2 partMap = node2part.get(nodeId);
if (partMap != null) {
GridDhtPartitionState state = partMap.get(part);
@@ -830,7 +830,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId,
+ @Nullable @Override public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
GridDhtPartitionFullMap partMap) {
if (log.isDebugEnabled())
log.debug("Updating full partition map [exchId=" + exchId + ", parts=" + fullMapString() + ']');
@@ -865,12 +865,17 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
lastExchangeId = exchId;
if (node2part != null) {
- for (GridDhtPartitionMap part : node2part.values()) {
- GridDhtPartitionMap newPart = partMap.get(part.nodeId());
+ for (GridDhtPartitionMap2 part : node2part.values()) {
+ GridDhtPartitionMap2 newPart = partMap.get(part.nodeId());
// If for some nodes current partition has a newer map,
// then we keep the newer value.
- if (newPart != null && newPart.updateSequence() < part.updateSequence()) {
+ if (newPart != null &&
+ (newPart.updateSequence() < part.updateSequence() || (
+ cctx.startTopologyVersion() != null &&
+ newPart.topologyVersion() != null && // Backward compatibility.
+ cctx.startTopologyVersion().compareTo(newPart.topologyVersion()) > 0))
+ ) {
if (log.isDebugEnabled())
log.debug("Overriding partition map in full update map [exchId=" + exchId + ", curPart=" +
mapString(part) + ", newPart=" + mapString(newPart) + ']');
@@ -896,7 +901,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
Map<Integer, Set<UUID>> p2n = new HashMap<>(cctx.affinity().partitions(), 1.0f);
- for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : partMap.entrySet()) {
for (Integer p : e.getValue().keySet()) {
Set<UUID> ids = p2n.get(p);
@@ -927,8 +932,8 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId,
- GridDhtPartitionMap parts) {
+ @Nullable @Override public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
+ GridDhtPartitionMap2 parts) {
if (log.isDebugEnabled())
log.debug("Updating single partition map [exchId=" + exchId + ", parts=" + mapString(parts) + ']');
@@ -961,7 +966,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
// Create invalid partition map.
node2part = new GridDhtPartitionFullMap();
- GridDhtPartitionMap cur = node2part.get(parts.nodeId());
+ GridDhtPartitionMap2 cur = node2part.get(parts.nodeId());
if (cur != null && cur.updateSequence() >= parts.updateSequence()) {
if (log.isDebugEnabled())
@@ -1132,10 +1137,10 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
}
- GridDhtPartitionMap map = node2part.get(nodeId);
+ GridDhtPartitionMap2 map = node2part.get(nodeId);
if (map == null)
- node2part.put(nodeId, map = new GridDhtPartitionMap(nodeId, updateSeq,
+ node2part.put(nodeId, map = new GridDhtPartitionMap2(nodeId, updateSeq, topVer,
Collections.<Integer, GridDhtPartitionState>emptyMap(), false));
map.updateSequence(updateSeq);
@@ -1175,7 +1180,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
part2node = new HashMap<>(part2node);
- GridDhtPartitionMap parts = node2part.remove(nodeId);
+ GridDhtPartitionMap2 parts = node2part.remove(nodeId);
if (parts != null) {
for (Integer p : parts.keySet()) {
@@ -1242,7 +1247,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Nullable @Override public GridDhtPartitionMap partitions(UUID nodeId) {
+ @Nullable @Override public GridDhtPartitionMap2 partitions(UUID nodeId) {
lock.readLock().lock();
try {
@@ -1277,7 +1282,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
if (nodeId == null)
return false;
- GridDhtPartitionMap parts = node2part.get(nodeId);
+ GridDhtPartitionMap2 parts = node2part.get(nodeId);
// Set can be null if node has been removed.
if (parts != null) {
@@ -1305,7 +1310,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
if (node2part == null)
return;
- for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : node2part.entrySet()) {
for (Integer p : e.getValue().keySet()) {
Set<UUID> nodeIds = part2node.get(p);
@@ -1317,7 +1322,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
for (Map.Entry<Integer, Set<UUID>> e : part2node.entrySet()) {
for (UUID nodeId : e.getValue()) {
- GridDhtPartitionMap map = node2part.get(nodeId);
+ GridDhtPartitionMap2 map = node2part.get(nodeId);
assert map != null : "Failed consistency check [part=" + e.getKey() + ", nodeId=" + nodeId + ']';
assert map.containsKey(e.getKey()) : "Failed consistency check [part=" + e.getKey() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
index ce2ba6c..498d492 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
@@ -31,7 +31,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
/**
* Full partition map.
*/
-public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap>
+public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
implements Comparable<GridDhtPartitionFullMap>, Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -65,9 +65,32 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap>
* @param nodeOrder Node order.
* @param updateSeq Update sequence number.
* @param m Map to copy.
+ */
+ @Deprecated // Backward compatibility.
+ public GridDhtPartitionFullMap(UUID nodeId, long nodeOrder, long updateSeq, Map<UUID, GridDhtPartitionMap2> m) {
+ assert nodeId != null;
+ assert updateSeq > 0;
+ assert nodeOrder > 0;
+
+ this.nodeId = nodeId;
+ this.nodeOrder = nodeOrder;
+ this.updateSeq = updateSeq;
+
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : m.entrySet()) {
+ GridDhtPartitionMap2 part = e.getValue();
+
+ put(e.getKey(), new GridDhtPartitionMap(part.nodeId(), part.updateSequence(), part.map()));
+ }
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @param nodeOrder Node order.
+ * @param updateSeq Update sequence number.
+ * @param m Map to copy.
* @param onlyActive If {@code true}, then only active partitions will be included.
*/
- public GridDhtPartitionFullMap(UUID nodeId, long nodeOrder, long updateSeq, Map<UUID, GridDhtPartitionMap> m,
+ public GridDhtPartitionFullMap(UUID nodeId, long nodeOrder, long updateSeq, Map<UUID, GridDhtPartitionMap2> m,
boolean onlyActive) {
assert nodeId != null;
assert updateSeq > 0;
@@ -77,11 +100,11 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap>
this.nodeOrder = nodeOrder;
this.updateSeq = updateSeq;
- for (Map.Entry<UUID, GridDhtPartitionMap> e : m.entrySet()) {
- GridDhtPartitionMap part = e.getValue();
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : m.entrySet()) {
+ GridDhtPartitionMap2 part = e.getValue();
if (onlyActive)
- put(e.getKey(), new GridDhtPartitionMap(part.nodeId(), part.updateSequence(), part.map(), true));
+ put(e.getKey(), new GridDhtPartitionMap2(part.nodeId(), part.updateSequence(), part.topologyVersion(), part.map(), true));
else
put(e.getKey(), part);
}
@@ -187,7 +210,7 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap>
nodeOrder = in.readLong();
updateSeq = in.readLong();
- putAll(U.<UUID, GridDhtPartitionMap>readMap(in));
+ putAll(U.<UUID, GridDhtPartitionMap2>readMap(in));
}
/** {@inheritDoc} */
@@ -209,7 +232,7 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap>
* @return Map string representation.
*/
public String map2string() {
- Iterator<Map.Entry<UUID, GridDhtPartitionMap>> it = entrySet().iterator();
+ Iterator<Map.Entry<UUID, GridDhtPartitionMap2>> it = entrySet().iterator();
if (!it.hasNext())
return "{}";
@@ -219,11 +242,11 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap>
buf.append('{');
while(true) {
- Map.Entry<UUID, GridDhtPartitionMap> e = it.next();
+ Map.Entry<UUID, GridDhtPartitionMap2> e = it.next();
UUID nodeId = e.getKey();
- GridDhtPartitionMap partMap = e.getValue();
+ GridDhtPartitionMap2 partMap = e.getValue();
buf.append(nodeId).append('=').append(partMap.toFullString());
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
index 86372ca..3096d63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
@@ -21,56 +21,27 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
-
/**
* Partition map.
*/
-public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Externalizable {
+@Deprecated // Backward compatibility, use GridDhtPartitionMap2 instead.
+public class GridDhtPartitionMap extends GridDhtPartitionMap2 {
/** */
private static final long serialVersionUID = 0L;
- /** Node ID. */
- private UUID nodeId;
-
- /** Update sequence number. */
- private long updateSeq;
-
- /** */
- private Map<Integer, GridDhtPartitionState> map;
-
- /** */
- private volatile int moving;
-
- /**
- * @param nodeId Node ID.
- * @param updateSeq Update sequence number.
- */
- public GridDhtPartitionMap(UUID nodeId, long updateSeq) {
- assert nodeId != null;
- assert updateSeq > 0;
-
- this.nodeId = nodeId;
- this.updateSeq = updateSeq;
-
- map = new HashMap<>();
- }
-
/**
* @param nodeId Node ID.
* @param updateSeq Update sequence number.
* @param m Map to copy.
- * @param onlyActive If {@code true}, then only active states will be included.
*/
- public GridDhtPartitionMap(UUID nodeId, long updateSeq, Map<Integer, GridDhtPartitionState> m, boolean onlyActive) {
+ public GridDhtPartitionMap(UUID nodeId, long updateSeq,
+ Map<Integer, GridDhtPartitionState> m) {
assert nodeId != null;
assert updateSeq > 0;
@@ -82,8 +53,7 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
for (Map.Entry<Integer, GridDhtPartitionState> e : m.entrySet()) {
GridDhtPartitionState state = e.getValue();
- if (!onlyActive || state.active())
- put(e.getKey(), state);
+ put(e.getKey(), state);
}
}
@@ -94,108 +64,6 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
// No-op.
}
- /**
- * @param part Partition.
- * @param state Partition state.
- */
- public void put(Integer part, GridDhtPartitionState state) {
- GridDhtPartitionState old = map.put(part, state);
-
- if (old == MOVING)
- moving--;
-
- if (state == MOVING)
- moving++;
- }
-
- /**
- * @return {@code true} If partition map contains moving partitions.
- */
- public boolean hasMovingPartitions() {
- assert moving >= 0 : moving;
-
- return moving != 0;
- }
-
- /**
- * @param part Partition.
- * @return Partition state.
- */
- public GridDhtPartitionState get(Integer part) {
- return map.get(part);
- }
-
- /**
- * @param part Partition.
- * @return {@code True} if contains given partition.
- */
- public boolean containsKey(Integer part) {
- return map.containsKey(part);
- }
-
- /**
- * @return Entries.
- */
- public Set<Map.Entry<Integer, GridDhtPartitionState>> entrySet() {
- return map.entrySet();
- }
-
- /**
- * @return Map size.
- */
- public int size() {
- return map.size();
- }
-
- /**
- * @return Partitions.
- */
- public Set<Integer> keySet() {
- return map.keySet();
- }
-
- /**
- * @return Underlying map.
- */
- public Map<Integer, GridDhtPartitionState> map() {
- return map;
- }
-
- /**
- * @return Node ID.
- */
- public UUID nodeId() {
- return nodeId;
- }
-
- /**
- * @return Update sequence.
- */
- public long updateSequence() {
- return updateSeq;
- }
-
- /**
- * @param updateSeq New update sequence value.
- * @return Old update sequence value.
- */
- public long updateSequence(long updateSeq) {
- long old = this.updateSeq;
-
- assert updateSeq >= old : "Invalid update sequence [cur=" + old + ", new=" + updateSeq + ']';
-
- this.updateSeq = updateSeq;
-
- return old;
- }
-
- /** {@inheritDoc} */
- @Override public int compareTo(GridDhtPartitionMap o) {
- assert nodeId.equals(o.nodeId);
-
- return Long.compare(updateSeq, o.updateSeq);
- }
-
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
U.writeUuid(out, nodeId);
@@ -249,7 +117,7 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
if (this == o)
return true;
- GridDhtPartitionMap other = (GridDhtPartitionMap)o;
+ GridDhtPartitionMap2 other = (GridDhtPartitionMap2)o;
return other.nodeId.equals(nodeId) && other.updateSeq == updateSeq;
}
@@ -263,11 +131,11 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
* @return Full string representation.
*/
public String toFullString() {
- return S.toString(GridDhtPartitionMap.class, this, "size", size(), "map", map.toString());
+ return S.toString(GridDhtPartitionMap2.class, this, "size", size(), "map", map.toString());
}
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(GridDhtPartitionMap.class, this, "size", size());
+ return S.toString(GridDhtPartitionMap2.class, this, "size", size());
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
new file mode 100644
index 0000000..4b3d280
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
@@ -0,0 +1,295 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteProductVersion;
+
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
+
+/**
+ * Partition map.
+ */
+public class GridDhtPartitionMap2 implements Comparable<GridDhtPartitionMap2>, Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Used since. */
+ public static final IgniteProductVersion SINCE = IgniteProductVersion.fromString("1.5.0");
+
+ /** Node ID. */
+ protected UUID nodeId;
+
+ /** Update sequence number. */
+ protected long updateSeq;
+
+ /** Topology version. */
+ protected AffinityTopologyVersion top;
+
+ /** */
+ protected Map<Integer, GridDhtPartitionState> map;
+
+ /** */
+ private volatile int moving;
+
+ /**
+ * @param nodeId Node ID.
+ * @param updateSeq Update sequence number.
+ */
+ public GridDhtPartitionMap2(UUID nodeId, long updateSeq) {
+ assert nodeId != null;
+ assert updateSeq > 0;
+
+ this.nodeId = nodeId;
+ this.updateSeq = updateSeq;
+
+ map = new HashMap<>();
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @param updateSeq Update sequence number.
+ * @param m Map to copy.
+ * @param onlyActive If {@code true}, then only active states will be included.
+ */
+ public GridDhtPartitionMap2(UUID nodeId, long updateSeq, AffinityTopologyVersion top,
+ Map<Integer, GridDhtPartitionState> m, boolean onlyActive) {
+ assert nodeId != null;
+ assert updateSeq > 0;
+
+ this.nodeId = nodeId;
+ this.updateSeq = updateSeq;
+ this.top = top;
+
+ map = U.newHashMap(m.size());
+
+ for (Map.Entry<Integer, GridDhtPartitionState> e : m.entrySet()) {
+ GridDhtPartitionState state = e.getValue();
+
+ if (!onlyActive || state.active())
+ put(e.getKey(), state);
+ }
+ }
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtPartitionMap2() {
+ // No-op.
+ }
+
+ /**
+ * @param part Partition.
+ * @param state Partition state.
+ */
+ public void put(Integer part, GridDhtPartitionState state) {
+ GridDhtPartitionState old = map.put(part, state);
+
+ if (old == MOVING)
+ moving--;
+
+ if (state == MOVING)
+ moving++;
+ }
+
+ /**
+ * @return {@code true} If partition map contains moving partitions.
+ */
+ public boolean hasMovingPartitions() {
+ assert moving >= 0 : moving;
+
+ return moving != 0;
+ }
+
+ /**
+ * @param part Partition.
+ * @return Partition state.
+ */
+ public GridDhtPartitionState get(Integer part) {
+ return map.get(part);
+ }
+
+ /**
+ * @param part Partition.
+ * @return {@code True} if contains given partition.
+ */
+ public boolean containsKey(Integer part) {
+ return map.containsKey(part);
+ }
+
+ /**
+ * @return Entries.
+ */
+ public Set<Map.Entry<Integer, GridDhtPartitionState>> entrySet() {
+ return map.entrySet();
+ }
+
+ /**
+ * @return Map size.
+ */
+ public int size() {
+ return map.size();
+ }
+
+ /**
+ * @return Partitions.
+ */
+ public Set<Integer> keySet() {
+ return map.keySet();
+ }
+
+ /**
+ * @return Underlying map.
+ */
+ public Map<Integer, GridDhtPartitionState> map() {
+ return map;
+ }
+
+ /**
+ * @return Node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Update sequence.
+ */
+ public long updateSequence() {
+ return updateSeq;
+ }
+
+ /**
+ * @param updateSeq New update sequence value.
+ * @return Old update sequence value.
+ */
+ public long updateSequence(long updateSeq) {
+ long old = this.updateSeq;
+
+ assert updateSeq >= old : "Invalid update sequence [cur=" + old + ", new=" + updateSeq + ']';
+
+ this.updateSeq = updateSeq;
+
+ return old;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ public AffinityTopologyVersion topologyVersion() {
+ return top;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int compareTo(GridDhtPartitionMap2 o) {
+ assert nodeId.equals(o.nodeId);
+
+ return Long.compare(updateSeq, o.updateSeq);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeUuid(out, nodeId);
+
+ out.writeLong(updateSeq);
+
+ int size = map.size();
+
+ out.writeInt(size);
+
+ int i = 0;
+
+ for (Map.Entry<Integer, GridDhtPartitionState> entry : map.entrySet()) {
+ int ordinal = entry.getValue().ordinal();
+
+ assert ordinal == (ordinal & 0x3);
+ assert entry.getKey() == (entry.getKey() & 0x3FFF);
+
+ int coded = (ordinal << 14) | entry.getKey();
+
+ out.writeShort((short)coded);
+
+ i++;
+ }
+
+ assert i == size;
+
+ out.writeLong(topologyVersion().topologyVersion());
+ out.writeInt(topologyVersion().minorTopologyVersion());
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ nodeId = U.readUuid(in);
+
+ updateSeq = in.readLong();
+
+ int size = in.readInt();
+
+ map = U.newHashMap(size);
+
+ for (int i = 0; i < size; i++) {
+ int entry = in.readShort() & 0xFFFF;
+
+ int part = entry & 0x3FFF;
+ int ordinal = entry >> 14;
+
+ put(part, GridDhtPartitionState.fromOrdinal(ordinal));
+ }
+
+ top = new AffinityTopologyVersion(in.readLong(), in.readInt());
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ GridDhtPartitionMap2 other = (GridDhtPartitionMap2)o;
+
+ return other.nodeId.equals(nodeId) && other.updateSeq == updateSeq;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return 31 * nodeId.hashCode() + (int)(updateSeq ^ (updateSeq >>> 32));
+ }
+
+ /**
+ * @return Full string representation.
+ */
+ public String toFullString() {
+ return S.toString(GridDhtPartitionMap2.class, this, "size", size(), "map", map.toString(), "top", top);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtPartitionMap2.class, this, "size", size());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 4fc4704..162d8d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -959,12 +959,17 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
private void sendLocalPartitions(ClusterNode node, @Nullable GridDhtPartitionExchangeId id) throws IgniteCheckedException {
GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(id,
clientOnlyExchange,
- cctx.versions().last(),
- id.topologyVersion());
+ cctx.versions().last());
for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
- if (!cacheCtx.isLocal())
- m.addLocalPartitionMap(cacheCtx.cacheId(), cacheCtx.topology().localPartitionMap());
+ if (!cacheCtx.isLocal()) {
+ GridDhtPartitionMap2 locMap = cacheCtx.topology().localPartitionMap();
+
+ if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
+ locMap = new GridDhtPartitionMap(locMap.nodeId(), locMap.updateSequence(), locMap.map());
+
+ m.addLocalPartitionMap(cacheCtx.cacheId(), locMap);
+ }
}
if (log.isDebugEnabled())
@@ -984,14 +989,28 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
lastVer.get(),
id.topologyVersion());
+ boolean useOldApi = false;
+
+ for (ClusterNode node : nodes) {
+ if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
+ useOldApi = true;
+ }
+
for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
if (!cacheCtx.isLocal()) {
AffinityTopologyVersion startTopVer = cacheCtx.startTopologyVersion();
boolean ready = startTopVer == null || startTopVer.compareTo(id.topologyVersion()) <= 0;
- if (ready)
- m.addFullPartitionsMap(cacheCtx.cacheId(), cacheCtx.topology().partitionMap(true));
+ if (ready) {
+ GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
+
+ if (useOldApi) {
+ locMap = new GridDhtPartitionFullMap(locMap.nodeId(), locMap.nodeOrder(), locMap.updateSequence(), locMap);
+ }
+
+ m.addFullPartitionsMap(cacheCtx.cacheId(), locMap);
+ }
}
}
@@ -1354,7 +1373,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
* @param msg Partitions single message.
*/
private void updatePartitionSingleMap(GridDhtPartitionsSingleMessage msg) {
- for (Map.Entry<Integer, GridDhtPartitionMap> entry : msg.partitions().entrySet()) {
+ for (Map.Entry<Integer, GridDhtPartitionMap2> entry : msg.partitions().entrySet()) {
Integer cacheId = entry.getKey();
GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index bb6ea27..7099bf1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@ -23,14 +23,12 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -43,7 +41,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/** Local partitions. */
@GridToStringInclude
@GridDirectTransient
- private Map<Integer, GridDhtPartitionMap> parts;
+ private Map<Integer, GridDhtPartitionMap2> parts;
/** Serialized partitions. */
private byte[] partsBytes;
@@ -51,9 +49,6 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/** */
private boolean client;
- /** Topology version. */
- private AffinityTopologyVersion topVer;
-
/**
* Required by {@link Externalizable}.
*/
@@ -68,12 +63,10 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
*/
public GridDhtPartitionsSingleMessage(GridDhtPartitionExchangeId exchId,
boolean client,
- @Nullable GridCacheVersion lastVer,
- @NotNull AffinityTopologyVersion topVer) {
+ @Nullable GridCacheVersion lastVer) {
super(exchId, lastVer);
this.client = client;
- this.topVer = topVer;
}
/**
@@ -89,7 +82,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
* @param cacheId Cache ID to add local partition for.
* @param locMap Local partition map.
*/
- public void addLocalPartitionMap(int cacheId, GridDhtPartitionMap locMap) {
+ public void addLocalPartitionMap(int cacheId, GridDhtPartitionMap2 locMap) {
if (parts == null)
parts = new HashMap<>();
@@ -99,7 +92,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/**
* @return Local partitions.
*/
- public Map<Integer, GridDhtPartitionMap> partitions() {
+ public Map<Integer, GridDhtPartitionMap2> partitions() {
return parts;
}
@@ -147,12 +140,6 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
writer.incrementState();
- case 7:
- if (!writer.writeMessage("topVer", topVer))
- return false;
-
- writer.incrementState();
-
}
return true;
@@ -185,14 +172,6 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
reader.incrementState();
- case 7:
- topVer = reader.readMessage("topVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
}
return reader.afterMessageRead(GridDhtPartitionsSingleMessage.class);
@@ -205,7 +184,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 8;
+ return 7;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index 111cab8..6171ff8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -37,7 +37,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheA
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.util.lang.IgnitePair;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -106,7 +106,7 @@ public class VisorCache implements Serializable {
private VisorCacheMetrics metrics;
/** Cache partitions states. */
- private GridDhtPartitionMap partitionsMap;
+ private GridDhtPartitionMap2 partitionsMap;
/**
* @param ignite Grid.
@@ -399,7 +399,7 @@ public class VisorCache implements Serializable {
/**
* @return Cache partitions states.
*/
- @Nullable public GridDhtPartitionMap partitionMap() {
+ @Nullable public GridDhtPartitionMap2 partitionMap() {
return partitionsMap;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 36ac156..065a72b 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -629,6 +629,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPar
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyPool$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyPool$DemandMessage
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
index ffb50ca..9d6e82f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
@@ -38,7 +38,7 @@ import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.util.typedef.CAX;
@@ -305,10 +305,10 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
GridDhtPartitionFullMap fullMap = top.partitionMap(true);
- for (Map.Entry<UUID, GridDhtPartitionMap> fe : fullMap.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> fe : fullMap.entrySet()) {
UUID nodeId = fe.getKey();
- GridDhtPartitionMap m = fe.getValue();
+ GridDhtPartitionMap2 m = fe.getValue();
for (Map.Entry<Integer, GridDhtPartitionState> e : m.entrySet()) {
int p = e.getKey();
@@ -439,12 +439,12 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
assert orig.keySet().equals(cmp.keySet());
- for (Map.Entry<UUID, GridDhtPartitionMap> entry : orig.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> entry : orig.entrySet()) {
UUID nodeId = entry.getKey();
- GridDhtPartitionMap nodeMap = entry.getValue();
+ GridDhtPartitionMap2 nodeMap = entry.getValue();
- GridDhtPartitionMap cmpMap = cmp.get(nodeId);
+ GridDhtPartitionMap2 cmpMap = cmp.get(nodeId);
assert cmpMap != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
index a71475c..34e4333 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
@@ -38,7 +38,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.CacheRebalancingEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P1;
@@ -361,7 +361,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
GridDhtPartitionFullMap allParts = dht.topology().partitionMap(false);
- for (GridDhtPartitionMap parts : allParts.values()) {
+ for (GridDhtPartitionMap2 parts : allParts.values()) {
if (!parts.nodeId().equals(g.cluster().localNode().id())) {
for (Map.Entry<Integer, GridDhtPartitionState> e : parts.entrySet()) {
int p = e.getKey();
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java
index df55f7e..dd46e23 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java
@@ -38,7 +38,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P1;
import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -114,7 +114,7 @@ public class GridCacheDhtTestUtils {
List<Integer> affParts = new LinkedList<>();
- GridDhtPartitionMap map = dht.topology().partitions(locNode.id());
+ GridDhtPartitionMap2 map = dht.topology().partitions(locNode.id());
if (map != null)
for (int p : map.keySet())
@@ -146,7 +146,7 @@ public class GridCacheDhtTestUtils {
System.out.println("\nNode map:");
- for (Map.Entry<UUID, GridDhtPartitionMap> e : top.partitionMap(false).entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : top.partitionMap(false).entrySet()) {
List<Integer> list = new ArrayList<>(e.getValue().keySet());
Collections.sort(list);
@@ -184,7 +184,7 @@ public class GridCacheDhtTestUtils {
// They should be in topology in OWNING state.
Collection<Integer> affParts = new HashSet<>();
- GridDhtPartitionMap map = dht.topology().partitions(locNode.id());
+ GridDhtPartitionMap2 map = dht.topology().partitions(locNode.id());
if (map != null)
for (int p : map.keySet())
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 9cf1e75..f515a78 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -58,7 +58,7 @@ import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
@@ -358,7 +358,7 @@ public class GridReduceQueryExecutor {
private boolean hasMovingPartitions(GridCacheContext<?,?> cctx) {
GridDhtPartitionFullMap fullMap = cctx.topology().partitionMap(false);
- for (GridDhtPartitionMap map : fullMap.values()) {
+ for (GridDhtPartitionMap2 map : fullMap.values()) {
if (map.hasMovingPartitions())
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java
index 83c50bd..ac91b51 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java
@@ -25,7 +25,7 @@ import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.yardstickframework.BenchmarkUtils;
@@ -53,7 +53,7 @@ public class WaitMapExchangeFinishCallable implements IgniteCallable<Void> {
boolean success = true;
if (top.topologyVersion().topologyVersion() == ignite.cluster().topologyVersion()) {
- for (Map.Entry<UUID, GridDhtPartitionMap> e : top.partitionMap(true).entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : top.partitionMap(true).entrySet()) {
for (Map.Entry<Integer, GridDhtPartitionState> p : e.getValue().entrySet()) {
if (p.getValue() != GridDhtPartitionState.OWNING) {
BenchmarkUtils.println("Not owning partition [part=" + p.getKey() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/afd55d9f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
index 83fc58f..1a700c2 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
@@ -38,7 +38,7 @@ import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.mxbean.IgniteMXBean;
@@ -196,7 +196,7 @@ public abstract class IgniteFailoverAbstractBenchmark<K, V> extends IgniteCacheA
GridDhtPartitionFullMap partMap = dht.topology().partitionMap(true);
- for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : partMap.entrySet()) {
log.info("Checking node: " + e.getKey());
for (Map.Entry<Integer, GridDhtPartitionState> e1 : e.getValue().entrySet()) {