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/20 16:18:09 UTC

[1/3] ignite git commit: Ignite-1913

Repository: ignite
Updated Branches:
  refs/heads/ignite-1.5 8e7e33090 -> ab8298afe


http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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/bcfe78b0/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/bcfe78b0/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/bcfe78b0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
new file mode 100644
index 0000000..a1ea7ad
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
@@ -0,0 +1,178 @@
+/*
+ *  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.rebalancing;
+
+import java.util.UUID;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jsr166.ConcurrentHashMap8;
+
+/**
+ *
+ */
+public class GridCacheRabalancingDelayedPartitionMapExchangeSelfTest extends GridCommonAbstractTest {
+    /** */
+    protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** partitioned cache name. */
+    protected static String CACHE = null;
+
+    /** */
+    private final ConcurrentHashMap8<UUID, Runnable> rs = new ConcurrentHashMap8<>();
+
+    /** */
+    private volatile boolean record = false;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration iCfg = super.getConfiguration(gridName);
+
+        TcpCommunicationSpi commSpi = new DelayableCommunicationSpi();
+
+        commSpi.setLocalPort(GridTestUtils.getNextCommPort(getClass()));
+        commSpi.setTcpNoDelay(true);
+
+        iCfg.setCommunicationSpi(commSpi);
+
+        return iCfg;
+    }
+
+    /**
+     * Helps to delay GridDhtPartitionsFullMessages.
+     */
+    public class DelayableCommunicationSpi extends TcpCommunicationSpi {
+        /** {@inheritDoc} */
+        @Override public void sendMessage(final ClusterNode node, final Message msg,
+            final IgniteInClosure<IgniteException> ackClosure) throws IgniteSpiException {
+            final Object msg0 = ((GridIoMessage)msg).message();
+
+            if (msg0 instanceof GridDhtPartitionsFullMessage && record &&
+                ((GridDhtPartitionsFullMessage)msg0).exchangeId() == null) {
+                rs.putIfAbsent(node.id(), new Runnable() {
+                    @Override public void run() {
+                        DelayableCommunicationSpi.super.sendMessage(node, msg, ackClosure);
+                    }
+                });
+            }
+            else
+                try {
+                    super.sendMessage(node, msg, ackClosure);
+                }
+                catch (Exception e) {
+                    U.log(null, e);
+                }
+
+        }
+    }
+
+    /**
+     * @throws Exception e.
+     */
+    public void test() throws Exception {
+        startGrid(0);
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(CACHE);
+        cfg.setCacheMode(CacheMode.PARTITIONED);
+        cfg.setRebalanceMode(CacheRebalanceMode.SYNC);
+        cfg.setBackups(1);
+
+        ignite(0).getOrCreateCache(cfg);
+
+        startGrid(1);
+        startGrid(2);
+        startGrid(3);
+
+        awaitPartitionMapExchange(true);
+
+        for (int i = 0; i < 2; i++) {
+            stopGrid(3);
+
+            awaitPartitionMapExchange(true);
+
+            startGrid(3);
+
+            awaitPartitionMapExchange(true);
+        }
+
+        startGrid(4);
+
+        awaitPartitionMapExchange(true);
+
+        assert rs.isEmpty();
+
+        record = true;
+
+        while (rs.size() < 3) { // N - 1 nodes.
+            U.sleep(10);
+        }
+
+        ignite(0).destroyCache(CACHE);
+
+        ignite(0).getOrCreateCache(cfg);
+
+        awaitPartitionMapExchange();
+
+        for (Runnable r : rs.values()) {
+            r.run();
+        }
+
+        U.sleep(10000); // Enough time to process delayed GridDhtPartitionsFullMessages.
+
+        stopGrid(3); // Forces exchange at all nodes and cause assertion failure in case obsolete partition map accepted.
+
+        awaitPartitionMapExchange();
+
+        long topVer0 = grid(0).context().cache().context().exchange().readyAffinityVersion().topologyVersion();
+        long topVer1 = grid(1).context().cache().context().exchange().readyAffinityVersion().topologyVersion();
+        long topVer2 = grid(2).context().cache().context().exchange().readyAffinityVersion().topologyVersion();
+
+        stopGrid(4); // Should force exchange in case exchange manager alive.
+
+        awaitPartitionMapExchange();
+
+        // Will fail in case exchange-workers are dead.
+        assert grid(0).context().cache().context().exchange().readyAffinityVersion().topologyVersion() > topVer0;
+        assert grid(1).context().cache().context().exchange().readyAffinityVersion().topologyVersion() > topVer1;
+        assert grid(2).context().cache().context().exchange().readyAffinityVersion().topologyVersion() > topVer2;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index ea13cdd..b02d022 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -49,6 +49,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNea
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearPartitionedP2PEnabledByteArrayValuesSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePutArrayValueSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.IgniteTxReentryNearSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRabalancingDelayedPartitionMapExchangeSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingAsyncSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingSyncSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingUnmarshallingFailedSelfTest;
@@ -141,6 +142,7 @@ public class IgniteCacheTestSuite3 extends TestSuite {
         suite.addTestSuite(GridCacheRebalancingSyncSelfTest.class);
         suite.addTestSuite(GridCacheRebalancingUnmarshallingFailedSelfTest.class);
         suite.addTestSuite(GridCacheRebalancingAsyncSelfTest.class);
+        suite.addTestSuite(GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.class);
 
         // Test for byte array value special case.
         suite.addTestSuite(GridCacheLocalByteArrayValuesSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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/bcfe78b0/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/bcfe78b0/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()) {


[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/bcfe78b0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bcfe78b0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bcfe78b0

Branch: refs/heads/ignite-1.5
Commit: bcfe78b030392ed74209ea40e83c8baaf02eb314
Parents: 900788b
Author: Anton Vinogradov <av...@gridgain.com>
Authored: Fri Nov 20 18:16:49 2015 +0300
Committer: Anton Vinogradov <av...@gridgain.com>
Committed: Fri Nov 20 18:16:49 2015 +0300

----------------------------------------------------------------------
 .../stream/camel/IgniteCamelStreamerTest.java   |  16 +-
 .../camel/IgniteCamelStreamerTestSuite.java     |   1 -
 .../internal/MarshallerContextAdapter.java      |   4 +-
 .../GridCachePartitionExchangeManager.java      |  34 ++-
 .../dht/GridClientPartitionTopology.java        |  38 +--
 .../distributed/dht/GridDhtLockFuture.java      |   1 -
 .../dht/GridDhtPartitionTopology.java           |  12 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |  45 +--
 .../distributed/dht/GridDhtTxPrepareFuture.java |   1 -
 .../dht/GridPartitionedGetFuture.java           |   2 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   1 -
 .../dht/preloader/GridDhtPartitionFullMap.java  |  41 ++-
 .../dht/preloader/GridDhtPartitionMap.java      | 148 +--------
 .../dht/preloader/GridDhtPartitionMap2.java     | 306 +++++++++++++++++++
 .../GridDhtPartitionsExchangeFuture.java        |  24 +-
 .../GridDhtPartitionsSingleMessage.java         |   6 +-
 .../distributed/near/GridNearCacheAdapter.java  |   1 -
 .../distributed/near/GridNearGetFuture.java     |   2 -
 .../distributed/near/GridNearLockFuture.java    |   2 -
 ...arOptimisticSerializableTxPrepareFuture.java |   3 -
 .../near/GridNearOptimisticTxPrepareFuture.java |   1 -
 .../near/GridNearTxFinishFuture.java            |   4 -
 .../distributed/near/GridNearTxRemote.java      |   1 -
 .../processors/cache/local/GridLocalCache.java  |   1 -
 .../cache/local/GridLocalLockFuture.java        |   2 -
 .../cache/transactions/IgniteInternalTx.java    |   1 -
 .../cache/transactions/IgniteTxAdapter.java     |   1 -
 .../transactions/IgniteTxLocalAdapter.java      |   1 -
 .../cache/transactions/IgniteTxManager.java     |   1 -
 .../cache/transactions/IgniteTxStateImpl.java   |   1 -
 .../ignite/internal/visor/cache/VisorCache.java |   6 +-
 .../org/apache/ignite/stream/StreamAdapter.java |   1 -
 .../resources/META-INF/classnames.properties    |   1 +
 .../dht/GridCacheDhtPreloadDelayedSelfTest.java |  12 +-
 .../dht/GridCacheDhtPreloadSelfTest.java        |   4 +-
 .../distributed/dht/GridCacheDhtTestUtils.java  |   8 +-
 ...cingDelayedPartitionMapExchangeSelfTest.java | 178 +++++++++++
 .../testsuites/IgniteCacheTestSuite3.java       |   2 +
 .../h2/twostep/GridReduceQueryExecutor.java     |   4 +-
 .../cache/WaitMapExchangeFinishCallable.java    |   4 +-
 .../IgniteFailoverAbstractBenchmark.java        |   4 +-
 41 files changed, 661 insertions(+), 265 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java b/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java
index 4795dff..f921a59 100644
--- a/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java
+++ b/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java
@@ -17,6 +17,13 @@
 
 package org.apache.ignite.stream.camel;
 
+import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
+import com.squareup.okhttp.MediaType;
+import com.squareup.okhttp.OkHttpClient;
+import com.squareup.okhttp.Request;
+import com.squareup.okhttp.RequestBody;
+import com.squareup.okhttp.Response;
 import java.io.IOException;
 import java.net.ServerSocket;
 import java.util.ArrayList;
@@ -28,7 +35,6 @@ import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
@@ -51,14 +57,6 @@ import org.apache.ignite.stream.StreamMultipleTupleExtractor;
 import org.apache.ignite.stream.StreamSingleTupleExtractor;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
-import com.squareup.okhttp.MediaType;
-import com.squareup.okhttp.OkHttpClient;
-import com.squareup.okhttp.Request;
-import com.squareup.okhttp.RequestBody;
-import com.squareup.okhttp.Response;
-
 import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTestSuite.java b/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTestSuite.java
index 266c9cf..fa7f542 100644
--- a/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTestSuite.java
+++ b/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTestSuite.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.stream.camel;
 
 import java.util.Set;
-
 import junit.framework.TestSuite;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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/bcfe78b0/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 cd89416..875a4e8 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
@@ -56,6 +56,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;
@@ -746,9 +747,23 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
     private boolean sendAllPartitions(Collection<? extends ClusterNode> nodes) {
         GridDhtPartitionsFullMessage m = new GridDhtPartitionsFullMessage(null, null, AffinityTopologyVersion.NONE);
 
+        boolean useOldApi = false;
+
+        for (ClusterNode node : nodes) {
+            if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
+                useOldApi = true;
+        }
+
         for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
-            if (!cacheCtx.isLocal() && cacheCtx.started())
-                m.addFullPartitionsMap(cacheCtx.cacheId(), cacheCtx.topology().partitionMap(true));
+            if (!cacheCtx.isLocal() && cacheCtx.started()) {
+                GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
+
+                if (useOldApi) {
+                    locMap = new GridDhtPartitionFullMap(locMap.nodeId(), locMap.nodeOrder(), locMap.updateSequence(), locMap);
+                }
+
+                m.addFullPartitionsMap(cacheCtx.cacheId(), locMap);
+            }
         }
 
         // It is important that client topologies be added after contexts.
@@ -786,14 +801,17 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
         for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
             if (!cacheCtx.isLocal()) {
-                GridDhtPartitionMap locMap = cacheCtx.topology().localPartitionMap();
+                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);
             }
         }
 
         for (GridClientPartitionTopology top : clientTops.values()) {
-            GridDhtPartitionMap locMap = top.localPartitionMap();
+            GridDhtPartitionMap2 locMap = top.localPartitionMap();
 
             m.addLocalPartitionMap(top.cacheId(), locMap);
         }
@@ -1019,11 +1037,17 @@ 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 &&
+                        entry.getValue() != null &&
+                        entry.getValue().topologyVersion() != null && // Backward compatibility.
+                        cacheCtx.startTopologyVersion().compareTo(entry.getValue().topologyVersion()) > 0)
+                        continue;
+
                     GridDhtPartitionTopology top = null;
 
                     if (cacheCtx == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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 b7169bf..8aef5ad 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;
@@ -137,7 +137,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();
     }
 
@@ -358,11 +358,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 {
@@ -375,7 +375,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);
@@ -529,7 +529,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,
         Map<Integer, Long> cntrMap) {
         if (log.isDebugEnabled())
@@ -560,8 +560,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.
@@ -591,7 +591,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);
 
@@ -623,8 +623,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,
         Map<Integer, Long> cntrMap) {
         if (log.isDebugEnabled())
             log.debug("Updating single partition map [exchId=" + exchId + ", parts=" + mapString(parts) + ']');
@@ -661,7 +661,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())
@@ -766,10 +766,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);
@@ -807,7 +807,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()) {
@@ -857,7 +857,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 {
@@ -902,7 +902,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) {
@@ -930,7 +930,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);
 
@@ -942,7 +942,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/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index a7978c9..75deac7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -63,7 +63,6 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.NotNull;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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 3ac2b85..dd06d6f 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
@@ -27,7 +27,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;
@@ -135,7 +135,7 @@ public interface GridDhtPartitionTopology {
     /**
      * @return Local IDs.
      */
-    public GridDhtPartitionMap localPartitionMap();
+    public GridDhtPartitionMap2 localPartitionMap();
 
     /**
      * @param nodeId Node ID.
@@ -199,7 +199,7 @@ public interface GridDhtPartitionTopology {
      * @param cntrMap Partition update counters.
      * @return Local partition map if there were evictions or {@code null} otherwise.
      */
-    public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId,
+    public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
         GridDhtPartitionFullMap partMap,
         @Nullable Map<Integer, Long> cntrMap);
 
@@ -209,8 +209,8 @@ public interface GridDhtPartitionTopology {
      * @param cntrMap Partition update counters.
      * @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,
         @Nullable Map<Integer, Long> cntrMap);
 
     /**
@@ -234,7 +234,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/bcfe78b0/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 39c55db..a0709c5 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;
@@ -158,7 +158,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();
     }
 
@@ -664,11 +664,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 {
@@ -681,7 +681,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);
@@ -847,7 +847,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,
         @Nullable Map<Integer, Long> cntrMap) {
         if (log.isDebugEnabled())
@@ -899,12 +899,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) + ']');
@@ -930,7 +935,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);
 
@@ -963,8 +968,8 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
 
     /** {@inheritDoc} */
     @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
-    @Nullable @Override public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId,
-        GridDhtPartitionMap parts, @Nullable Map<Integer, Long> cntrMap) {
+    @Nullable @Override public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
+        GridDhtPartitionMap2 parts, @Nullable Map<Integer, Long> cntrMap) {
         if (log.isDebugEnabled())
             log.debug("Updating single partition map [exchId=" + exchId + ", parts=" + mapString(parts) + ']');
 
@@ -1013,7 +1018,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())
@@ -1186,10 +1191,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);
@@ -1229,7 +1234,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()) {
@@ -1296,7 +1301,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public GridDhtPartitionMap partitions(UUID nodeId) {
+    @Nullable @Override public GridDhtPartitionMap2 partitions(UUID nodeId) {
         lock.readLock().lock();
 
         try {
@@ -1383,7 +1388,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) {
@@ -1411,7 +1416,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);
 
@@ -1423,7 +1428,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/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 4cb5d05..745a427 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -74,7 +74,6 @@ import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteFutureCancelledException;
 import org.apache.ignite.lang.IgniteReducer;
 import org.apache.ignite.lang.IgniteUuid;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index c3d9836..3b92aab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -59,7 +59,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.*;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.SINGLE_GET_MSG_SINCE;
 
 /**
  * Colocated get future.

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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 8245d88..844d995 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
@@ -66,7 +66,6 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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/bcfe78b0/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/bcfe78b0/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..6cbc66b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
@@ -0,0 +1,306 @@
+/*
+ * 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;
+
+        if (top != null) {
+            out.writeLong(topologyVersion().topologyVersion());
+            out.writeInt(topologyVersion().minorTopologyVersion());
+        }
+        else {
+            out.writeLong(0);
+            out.writeInt(0);
+        }
+    }
+
+    /** {@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));
+        }
+
+        long ver = in.readLong();
+        int minorVer = in.readInt();
+
+        if (ver != 0) {
+            top = new AffinityTopologyVersion(ver, minorVer);
+        }
+    }
+
+    /** {@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/bcfe78b0/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 43f34c9..f7e6acc 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
@@ -971,8 +971,13 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
 
         for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
             if (!cacheCtx.isLocal()) {
-                m.addLocalPartitionMap(cacheCtx.cacheId(), cacheCtx.topology().localPartitionMap());
+                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);
+                
                 m.partitionUpdateCounters(cacheCtx.cacheId(), cacheCtx.topology().updateCounters());
             }
         }
@@ -994,6 +999,13 @@ 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();
@@ -1001,7 +1013,13 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                 boolean ready = startTopVer == null || startTopVer.compareTo(id.topologyVersion()) <= 0;
 
                 if (ready) {
-                    m.addFullPartitionsMap(cacheCtx.cacheId(), cacheCtx.topology().partitionMap(true));
+                    GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
+
+                    if (useOldApi) {
+                        locMap = new GridDhtPartitionFullMap(locMap.nodeId(), locMap.nodeOrder(), locMap.updateSequence(), locMap);
+                    }
+
+                    m.addFullPartitionsMap(cacheCtx.cacheId(), locMap);
 
                     m.addPartitionUpdateCounters(cacheCtx.cacheId(), cacheCtx.topology().updateCounters());
                 }
@@ -1372,7 +1390,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/bcfe78b0/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 a2366bf..c07a508 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
@@ -42,7 +42,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;
@@ -91,7 +91,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<>();
 
@@ -126,7 +126,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
     /**
      * @return Local partitions.
      */
-    public Map<Integer, GridDhtPartitionMap> partitions() {
+    public Map<Integer, GridDhtPartitionMap2> partitions() {
         return parts;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index eb0b637..cc9d007 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -65,7 +65,6 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.P1;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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 dfaa44e..4a030b4 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
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicReference;
@@ -60,7 +59,6 @@ import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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 76f2fbe..eb85802 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
@@ -57,12 +57,10 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.C2;
 import org.apache.ignite.internal.util.typedef.CI1;
-import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 770c47a..144070c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -34,7 +34,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
 import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
-import org.apache.ignite.internal.processors.cache.GridCacheMvccFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxMapping;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxMapping;
@@ -46,7 +45,6 @@ import org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedExceptio
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
 import org.apache.ignite.internal.util.GridConcurrentHashSet;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -60,7 +58,6 @@ import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteReducer;
 import org.apache.ignite.lang.IgniteUuid;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index eaf476c..e70e574 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -44,7 +44,6 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
 import org.apache.ignite.internal.util.GridConcurrentHashSet;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.C1;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index 102cc4b..f76fc96 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicReference;
 import org.apache.ignite.IgniteCheckedException;
@@ -40,7 +39,6 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.future.GridCompoundIdentityFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -49,11 +47,9 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.transactions.TransactionRollbackException;
-import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.processors.cache.GridCacheOperation.NOOP;
 import static org.apache.ignite.transactions.TransactionState.UNKNOWN;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
index ba58f57..8e56f5d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
@@ -21,7 +21,6 @@ import java.io.Externalizable;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.UUID;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
index 544d5b4..821455a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
-import org.apache.ignite.internal.processors.cache.GridCacheFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntryFactory;
 import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java
index d392d53..f1dbc7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java
@@ -19,13 +19,11 @@ package org.apache.ignite.internal.processors.cache.local;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicReference;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
index eb0db4a..f5f99f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
@@ -35,7 +35,6 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.lang.GridTuple;
 import org.apache.ignite.lang.IgniteAsyncSupported;
 import org.apache.ignite.lang.IgniteUuid;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 3ddd909..6a0f8ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -54,7 +54,6 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersionedEntryEx;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter;
 import org.apache.ignite.internal.util.lang.GridTuple;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index cff62d9..ed3602f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -67,7 +67,6 @@ import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
 import org.apache.ignite.internal.util.GridLeanMap;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 247ccaf..cad2a8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -59,7 +59,6 @@ import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter;
 import org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
 import org.apache.ignite.internal.util.GridBoundedConcurrentOrderedMap;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.IgnitePair;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java
index 213c5e6..1256aa6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.transactions;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import org.apache.ignite.IgniteCheckedException;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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/bcfe78b0/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
index afc1530..cb9566b 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.stream;
 
 import java.util.Map;
-
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteDataStreamer;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bcfe78b0/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


[3/3] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1.5
Commit: ab8298afe65973750abe40f402246c77283955ba
Parents: bcfe78b 8e7e330
Author: Anton Vinogradov <av...@gridgain.com>
Authored: Fri Nov 20 18:17:49 2015 +0300
Committer: Anton Vinogradov <av...@gridgain.com>
Committed: Fri Nov 20 18:17:49 2015 +0300

----------------------------------------------------------------------
 .../datastructures/IgniteSemaphoreExample.java  | 168 ++++
 .../ignite/examples/CacheExamplesSelfTest.java  |  10 +-
 .../src/main/java/org/apache/ignite/Ignite.java |  17 +
 .../java/org/apache/ignite/IgniteSemaphore.java | 312 ++++++++
 .../apache/ignite/events/DiscoveryEvent.java    |   6 +-
 .../apache/ignite/internal/IgniteKernal.java    |  21 +
 .../datastructures/DataStructuresProcessor.java | 199 ++++-
 .../datastructures/GridCacheSemaphoreEx.java    |  47 ++
 .../datastructures/GridCacheSemaphoreImpl.java  | 763 +++++++++++++++++++
 .../datastructures/GridCacheSemaphoreState.java | 144 ++++
 .../IgniteClientReconnectAtomicsTest.java       |  44 +-
 ...eAbstractDataStructuresFailoverSelfTest.java | 275 ++++++-
 .../IgniteClientDataStructuresAbstractTest.java |  59 +-
 .../IgniteDataStructureUniqueNameTest.java      |  14 +-
 .../IgniteSemaphoreAbstractSelfTest.java        | 411 ++++++++++
 .../local/IgniteLocalSemaphoreSelfTest.java     |  98 +++
 .../IgnitePartitionedSemaphoreSelfTest.java     |  33 +
 ...eplicatedDataStructuresFailoverSelfTest.java |   2 +-
 .../IgniteReplicatedSemaphoreSelfTest.java      |  33 +
 .../cache/GridCacheDataStructuresLoadTest.java  | 283 ++++---
 .../ignite/testframework/junits/IgniteMock.java |  10 +
 .../junits/multijvm/IgniteProcessProxy.java     |   7 +
 .../org/apache/ignite/IgniteSpringBean.java     |  12 +
 23 files changed, 2837 insertions(+), 131 deletions(-)
----------------------------------------------------------------------