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 2017/09/26 14:24:52 UTC

[01/17] ignite git commit: IGNITE-5732 Provide API to test compatibility with old releases

Repository: ignite
Updated Branches:
  refs/heads/ignite-3479 58fc58635 -> 331a255cd


http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index 3075920..2f91e40 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -40,10 +40,10 @@ import org.apache.ignite.IgniteEvents;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.IgniteIllegalStateException;
+import org.apache.ignite.IgniteLock;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteMessaging;
 import org.apache.ignite.IgniteQueue;
-import org.apache.ignite.IgniteLock;
 import org.apache.ignite.IgniteScheduler;
 import org.apache.ignite.IgniteSemaphore;
 import org.apache.ignite.IgniteServices;
@@ -137,27 +137,11 @@ public class IgniteProcessProxy implements IgniteEx {
         throws Exception {
         this.cfg = cfg;
         this.locJvmGrid = locJvmGrid;
-        this.log = log.getLogger("jvm-" + id.toString().substring(0, id.toString().indexOf('-')));
-
-        String cfgFileName = IgniteNodeRunner.storeToFile(cfg.setNodeId(id), resetDiscovery);
-
-        Collection<String> filteredJvmArgs = new ArrayList<>();
-
-        filteredJvmArgs.add("-ea");
+        this.log = logger(log, "jvm-" + id.toString().substring(0, id.toString().indexOf('-')));
 
-        Marshaller marsh = cfg.getMarshaller();
+        String params = params(cfg, resetDiscovery);
 
-        if (marsh != null)
-            filteredJvmArgs.add("-D" + IgniteTestResources.MARSH_CLASS_NAME + "=" + marsh.getClass().getName());
-        else
-            filteredJvmArgs.add("-D" + IgniteTestResources.MARSH_CLASS_NAME + "=" + BinaryMarshaller.class.getName());
-
-        for (String arg : U.jvmArgs()) {
-            if (arg.startsWith("-Xmx") || arg.startsWith("-Xms") ||
-                arg.startsWith("-cp") || arg.startsWith("-classpath") ||
-                (marsh != null && arg.startsWith("-D" + IgniteTestResources.MARSH_CLASS_NAME)))
-                filteredJvmArgs.add(arg);
-        }
+        Collection<String> filteredJvmArgs = filteredJvmArgs();
 
         final CountDownLatch rmtNodeStartedLatch = new CountDownLatch(1);
 
@@ -165,8 +149,8 @@ public class IgniteProcessProxy implements IgniteEx {
             locJvmGrid.events().localListen(new NodeStartedListener(id, rmtNodeStartedLatch), EventType.EVT_NODE_JOINED);
 
         proc = GridJavaProcess.exec(
-            IgniteNodeRunner.class.getCanonicalName(),
-            cfgFileName, // Params.
+            igniteNodeRunnerClassName(),
+            params,
             this.log,
             // Optional closure to be called each time wrapped process prints line to system.out or system.err.
             new IgniteInClosure<String>() {
@@ -194,6 +178,68 @@ public class IgniteProcessProxy implements IgniteEx {
     }
 
     /**
+     * Creates new logger instance based on given logger and given category.
+     *
+     * @param log Base logger.
+     * @param ctgr Category.
+     * @return Initiated logger.
+     * @throws Exception In case of an error.
+     */
+    protected IgniteLogger logger(IgniteLogger log, Object ctgr) throws Exception {
+        return log.getLogger(ctgr);
+    }
+
+    /**
+     * Gets Ignite node runner class name.
+     *
+     * @return Node runner class name.
+     * @throws Exception In case of an error.
+     */
+    protected String igniteNodeRunnerClassName() throws Exception {
+        return IgniteNodeRunner.class.getCanonicalName();
+    }
+
+    /**
+     * Creates parameters which will be passed to new Ignite Process as command line arguments.
+     *
+     * @param cfg Configuration.
+     * @param resetDiscovery Reset DiscoverySpi at the configuration.
+     * @return Params to be passed to new Ignite process.
+     * @throws Exception In case of an error.
+     */
+    protected String params(IgniteConfiguration cfg, boolean resetDiscovery) throws Exception {
+        return IgniteNodeRunner.storeToFile(cfg.setNodeId(id), resetDiscovery);
+    }
+
+    /**
+     * Creates list of JVM arguments to be used to start new Ignite process in separate JVM.
+     *
+     * @return JVM arguments.
+     * @throws Exception In case of an error.
+     */
+    protected Collection<String> filteredJvmArgs() throws Exception {
+        Collection<String> filteredJvmArgs = new ArrayList<>();
+
+        filteredJvmArgs.add("-ea");
+
+        Marshaller marsh = cfg.getMarshaller();
+
+        if (marsh != null)
+            filteredJvmArgs.add("-D" + IgniteTestResources.MARSH_CLASS_NAME + "=" + marsh.getClass().getName());
+        else
+            filteredJvmArgs.add("-D" + IgniteTestResources.MARSH_CLASS_NAME + "=" + BinaryMarshaller.class.getName());
+
+        for (String arg : U.jvmArgs()) {
+            if (arg.startsWith("-Xmx") || arg.startsWith("-Xms") ||
+                arg.startsWith("-cp") || arg.startsWith("-classpath") ||
+                (marsh != null && arg.startsWith("-D" + IgniteTestResources.MARSH_CLASS_NAME)))
+                filteredJvmArgs.add(arg);
+        }
+
+        return filteredJvmArgs;
+    }
+
+    /**
      */
     private static class NodeStartedListener extends IgnitePredicateX<Event> {
         /** Id. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cfa266d..d60863f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,6 +103,7 @@
             <modules> <!-- sorted alphabetically -->
                 <module>examples</module>
                 <module>modules/benchmarks</module>
+                <module>modules/compatibility</module>
                 <module>modules/geospatial</module>
                 <module>modules/hibernate-4.2</module>
                 <module>modules/hibernate-5.1</module>
@@ -166,6 +167,13 @@
         </profile>
 
         <profile>
+            <id>compatibility</id>
+            <modules>
+                <module>modules/compatibility</module>
+            </modules>
+        </profile>
+
+        <profile>
             <id>javadoc</id>
             <build>
                 <plugins>


[16/17] ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-3478' into ignite-3479

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

# Conflicts:
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java


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

Branch: refs/heads/ignite-3479
Commit: f3229affba146453671018244b99590c5280ee17
Parents: 3888d69 cc07f9f
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 26 14:57:25 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 26 14:57:25 2017 +0300

----------------------------------------------------------------------
 modules/compatibility/README.txt                |   5 +
 modules/compatibility/licenses/apache-2.0.txt   | 202 ++++++++
 modules/compatibility/pom.xml                   |  94 ++++
 .../ignite/compatibility/package-info.java      |  22 +
 .../DummyPersistenceCompatibilityTest.java      | 108 ++++
 ...itePersistenceCompatibilityAbstractTest.java |  89 ++++
 .../compatibility/persistence/package-info.java |  22 +
 .../junits/CompatibilityTestsFacade.java        |  46 ++
 .../junits/IgniteCompatibilityAbstractTest.java | 280 +++++++++++
 .../junits/IgniteCompatibilityNodeRunner.java   | 157 ++++++
 .../logger/ListenedGridTestLog4jLogger.java     |  91 ++++
 .../junits/logger/package-info.java             |  22 +
 .../testframework/junits/package-info.java      |  22 +
 .../testframework/package-info.java             |  22 +
 .../plugins/DisabledValidationProcessor.java    |  42 ++
 .../TestCompatibilityPluginProvider.java        | 119 +++++
 .../testframework/plugins/package-info.java     |  22 +
 .../testframework/util/MavenUtils.java          | 208 ++++++++
 .../testframework/util/package-info.java        |  22 +
 .../IgniteCompatibilityBasicTestSuite.java      |  38 ++
 .../compatibility/testsuites/package-info.java  |  22 +
 .../org.apache.ignite.plugin.PluginProvider     |   1 +
 .../configuration/IgniteConfiguration.java      |   6 +
 .../cache/GatewayProtectedCacheProxy.java       |   5 -
 .../processors/cache/GridCacheAdapter.java      | 135 +++--
 .../processors/cache/GridCacheProxyImpl.java    |  12 -
 .../processors/cache/IgniteCacheProxy.java      |   8 -
 .../processors/cache/IgniteCacheProxyImpl.java  |  16 -
 .../processors/cache/IgniteInternalCache.java   |   9 -
 .../dht/CacheDistributedGetFutureAdapter.java   |   5 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |   5 -
 .../cache/distributed/dht/GridDhtGetFuture.java |   2 -
 .../distributed/dht/GridDhtGetSingleFuture.java |   6 +-
 .../dht/GridDhtPartitionTopologyImpl.java       | 495 ++++++++++---------
 .../dht/GridPartitionedGetFuture.java           |  24 +-
 .../dht/GridPartitionedSingleGetFuture.java     |   5 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  67 +--
 .../dht/colocated/GridDhtColocatedCache.java    |  24 +-
 .../distributed/near/GridNearAtomicCache.java   |   2 -
 .../distributed/near/GridNearCacheAdapter.java  |   3 -
 .../distributed/near/GridNearCacheEntry.java    |   1 -
 .../distributed/near/GridNearGetFuture.java     |   3 -
 .../near/GridNearTransactionalCache.java        |   3 -
 .../cache/distributed/near/GridNearTxLocal.java |   2 -
 .../local/atomic/GridLocalAtomicCache.java      |   2 -
 .../processors/cache/mvcc/MvccCoordinator.java  |   7 +
 .../GridCacheDatabaseSharedManager.java         |  10 +-
 .../wal/FileWriteAheadLogManager.java           |   4 +-
 .../utils/PlatformConfigurationUtils.java       |  10 +
 .../processors/query/GridQueryProcessor.java    |   2 +-
 .../ignite/internal/util/IgniteUtils.java       |   9 +
 .../org.apache.ignite.plugin.PluginProvider     |   2 +-
 .../IgniteCacheTopologySafeGetSelfTest.java     | 222 ---------
 .../local/GridCacheLocalFullApiSelfTest.java    |  76 ++-
 .../IgnitePdsExchangeDuringCheckpointTest.java  | 135 +++++
 .../file/IgnitePdsThreadInterruptionTest.java   |   2 +-
 .../persistence/db/wal/IgnitePdsWalTlbTest.java |   4 +-
 .../junits/multijvm/IgniteNodeRunner.java       |   2 +-
 .../junits/multijvm/IgniteProcessProxy.java     |  90 +++-
 .../IgniteCacheDataStructuresSelfTestSuite.java |   4 +-
 .../IgniteCacheFailoverTestSuite.java           |   2 -
 .../ignite/testsuites/IgnitePdsTestSuite2.java  |   4 +
 .../cache/hibernate/HibernateCacheProxy.java    |   5 -
 .../TestExtensions.cs                           |   2 +
 .../Apache.Ignite.Core.Tests.csproj             |   4 +
 .../Binary/BinaryDynamicRegistrationTest.cs     |  15 +-
 .../Cache/CacheConfigurationTest.cs             |  39 +-
 .../Cache/PersistentStoreTest.cs                |  47 +-
 .../Config/Dynamic/dynamic-data.xml             |   2 +
 .../Config/cache-default.xml                    |  56 +++
 .../IgniteConfigurationSerializerTest.cs        |  65 +--
 .../IgniteConfigurationTest.cs                  |  73 ++-
 .../Apache.Ignite.Core.Tests/TestUtils.cs       |  61 +++
 .../Cache/Configuration/CacheConfiguration.cs   |  14 +-
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  10 +
 .../IgniteConfigurationSection.xsd              |   5 +
 .../Common/IgniteConfigurationXmlSerializer.cs  |   4 +-
 pom.xml                                         |   8 +
 78 files changed, 2624 insertions(+), 867 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f3229aff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/f3229aff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 6c74ecd,63156fc..7c2e0a5
--- 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
@@@ -137,15 -127,12 +128,17 @@@ public class GridPartitionedGetFuture<K
              log = U.logger(cctx.kernalContext(), logRef, GridPartitionedGetFuture.class);
      }
  
 +    /** {@inheritDoc} */
 +    @Nullable @Override public MvccCoordinatorVersion onCoordinatorChange(ClusterNode oldCrd, ClusterNode newCrd) {
 +        return null;
 +    }
 +
      /**
       * Initializes future.
+      *
+      * @param topVer Topology version.
       */
-     public void init() {
+     public void init(AffinityTopologyVersion topVer) {
          AffinityTopologyVersion lockedTopVer = cctx.shared().lockedTopologyVersion(null);
  
          if (lockedTopVer != null) {
@@@ -181,31 -179,9 +174,31 @@@
              return;
          }
  
-         IgniteInternalFuture<MvccCoordinatorVersion> cntrFut = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
 -        map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer);
++            final AffinityTopologyVersion topVer0 = topVer;IgniteInternalFuture<MvccCoordinatorVersion> cntrFut = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
  
 -        markInitialized();
 +        cntrFut.listen(new IgniteInClosure<IgniteInternalFuture<MvccCoordinatorVersion>>() {
 +            @Override public void apply(IgniteInternalFuture<MvccCoordinatorVersion> fut) {
 +                try {
 +                    mvccVer = fut.get();
 +
 +                    map(keys,
 +                        Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(),
 +                        topVer);
 +
 +                    markInitialized();
 +                }
 +                catch (ClusterTopologyCheckedException e) {
 +                    if (canRemap) {
 +
 +                    }
 +                    else
 +                        onDone(new ClusterTopologyCheckedException("Failed to request mvcc version, coordinator failed: " + mvccCrd));
 +                }
 +                catch (IgniteCheckedException e) {
 +                    onDone(e);
 +                }
 +            }
 +        });
      }
  
      /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/f3229aff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCoordinator.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCoordinator.java
index 0000000,0000000..cc92cc3
new file mode 100644
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCoordinator.java
@@@ -1,0 -1,0 +1,7 @@@
++package org.apache.ignite.internal.processors.cache.mvcc;
++
++/**
++ *
++ */
++public class MvccCoordinator {
++}


[12/17] ignite git commit: Removed unused internal getTopologySafe method.

Posted by sb...@apache.org.
Removed unused internal getTopologySafe method.


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

Branch: refs/heads/ignite-3479
Commit: aefa9a8a7c8e90ed0a285a2d4e0d3c223860e40d
Parents: 357f603
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 26 12:39:28 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 26 12:39:28 2017 +0300

----------------------------------------------------------------------
 .../cache/GatewayProtectedCacheProxy.java       |   5 -
 .../processors/cache/GridCacheAdapter.java      |  73 ++----
 .../processors/cache/GridCacheProxyImpl.java    |  12 -
 .../processors/cache/IgniteCacheProxy.java      |   8 -
 .../processors/cache/IgniteCacheProxyImpl.java  |  16 --
 .../processors/cache/IgniteInternalCache.java   |   9 -
 .../dht/CacheDistributedGetFutureAdapter.java   |   5 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |   5 -
 .../cache/distributed/dht/GridDhtGetFuture.java |   2 -
 .../distributed/dht/GridDhtGetSingleFuture.java |   2 -
 .../dht/GridPartitionedGetFuture.java           |  22 +-
 .../dht/GridPartitionedSingleGetFuture.java     |   5 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  67 +-----
 .../dht/colocated/GridDhtColocatedCache.java    |  24 +-
 .../distributed/near/GridNearAtomicCache.java   |   2 -
 .../distributed/near/GridNearCacheAdapter.java  |   3 -
 .../distributed/near/GridNearCacheEntry.java    |   1 -
 .../distributed/near/GridNearGetFuture.java     |   3 -
 .../near/GridNearTransactionalCache.java        |   3 -
 .../cache/distributed/near/GridNearTxLocal.java |   2 -
 .../local/atomic/GridLocalAtomicCache.java      |   2 -
 .../IgniteCacheTopologySafeGetSelfTest.java     | 222 -------------------
 .../IgniteCacheFailoverTestSuite.java           |   2 -
 .../cache/hibernate/HibernateCacheProxy.java    |   5 -
 24 files changed, 31 insertions(+), 469 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java
index 5ba6810..37bf9bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java
@@ -1703,11 +1703,6 @@ public class GatewayProtectedCacheProxy<K, V> extends AsyncSupportAdapter<Ignite
     }
 
     /** {@inheritDoc} */
-    @Override public V getTopologySafe(K key) {
-        return delegate.getTopologySafe(key);
-    }
-
-    /** {@inheritDoc} */
     @Override public IgniteCache<K, V> withAsync() {
         return delegate.withAsync();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index c7e40ec..6d9f0d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -629,9 +629,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             /*subj id*/null,
             /*task name*/null,
             /*deserialize binary*/false,
-            /*skip values*/
-            /*can remap*/true,
-            true,
+            /*skip values*/true,
             false);
     }
 
@@ -659,10 +657,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             /*task name*/null,
             /*deserialize binary*/false,
             opCtx != null && opCtx.recovery(),
-            /*skip values*/
-            /*can remap*/true,
-            true,
-            false).chain(new CX1<IgniteInternalFuture<Map<K, V>>, Boolean>() {
+            /*skip values*/true,
+            /*need ver*/false).chain(new CX1<IgniteInternalFuture<Map<K, V>>, Boolean>() {
             @Override public Boolean applyx(IgniteInternalFuture<Map<K, V>> fut) throws IgniteCheckedException {
                 Map<K, V> kvMap = fut.get();
 
@@ -1267,10 +1263,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             taskName,
             /*deserialize cache objects*/true,
             opCtx != null && opCtx.recovery(),
-            /*skip values*/
-            /*can remap*/false,
-            true,
-            false).get().get(key);
+            /*skip values*/false,
+            /*need ver*/false).get().get(key);
     }
 
     /** {@inheritDoc} */
@@ -1287,9 +1281,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             taskName,
             true,
             opCtx != null && opCtx.recovery(),
-            /*can remap*/false,
-            true,
-            false).chain(new CX1<IgniteInternalFuture<Map<K, V>>, V>() {
+            /*skip vals*/false,
+            /*can remap*/false).chain(new CX1<IgniteInternalFuture<Map<K, V>>, V>() {
             @Override public V applyx(IgniteInternalFuture<Map<K, V>> e) throws IgniteCheckedException {
                 return e.get().get(key);
             }
@@ -1297,26 +1290,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public final V getTopologySafe(K key) throws IgniteCheckedException {
-        String taskName = ctx.kernalContext().job().currentTaskName();
-
-        CacheOperationContext opCtx = ctx.operationContextPerCall();
-
-        return getAllAsync(
-            F.asList(key),
-            /*force primary*/false,
-            /*skip tx*/false,
-            /*subject id*/null,
-            taskName,
-            /*deserialize cache objects*/true,
-            opCtx != null && opCtx.recovery(),
-            /*skip values*/
-            /*can remap*/false,
-            false,
-            false).get().get(key);
-    }
-
-    /** {@inheritDoc} */
     @Nullable @Override public final Map<K, V> getAllOutTx(Set<? extends K> keys) throws IgniteCheckedException {
         return getAllOutTxAsync(keys).get();
     }
@@ -1334,9 +1307,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             taskName,
             !(opCtx != null && opCtx.isKeepBinary()),
             opCtx != null && opCtx.recovery(),
-            /*skip values*/
-            /*can remap*/false,
-            true, false);
+            /*skip values*/false,
+            /*need ver*/false);
     }
 
     /** {@inheritDoc} */
@@ -1543,7 +1515,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             !(opCtx != null && opCtx.isKeepBinary()),
             opCtx != null && opCtx.recovery(),
             /*skip vals*/false,
-            /*can remap*/true,
             /*need ver*/false);
 
         if (ctx.config().getInterceptor() != null)
@@ -1582,7 +1553,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 !(opCtx != null && opCtx.isKeepBinary()),
                 opCtx != null && opCtx.recovery(),
                 /*skip vals*/false,
-                /*can remap*/true,
                 /*need ver*/true));
 
         final boolean intercept = ctx.config().getInterceptor() != null;
@@ -1705,7 +1675,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @param taskName Task name.
      * @param deserializeBinary Deserialize binary.
      * @param skipVals Skip values.
-     * @param canRemap Can remap flag.
      * @param needVer Need version.
      * @return Future for the get operation.
      */
@@ -1717,7 +1686,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         String taskName,
         boolean deserializeBinary,
         final boolean skipVals,
-        boolean canRemap,
         final boolean needVer
     ) {
         CacheOperationContext opCtx = ctx.operationContextPerCall();
@@ -1730,7 +1698,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             deserializeBinary,
             opCtx != null && opCtx.recovery(),
             skipVals,
-            canRemap,
             needVer).chain(
             new CX1<IgniteInternalFuture<Map<K, V>>, V>() {
                 @Override public V applyx(IgniteInternalFuture<Map<K, V>> e) throws IgniteCheckedException {
@@ -1758,7 +1725,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @param deserializeBinary Deserialize binary.
      * @param recovery Recovery mode flag.
      * @param skipVals Skip values.
-     * @param canRemap Can remap flag.
      * @param needVer Need version.
      * @return Future for the get operation.
      * @see GridCacheAdapter#getAllAsync(Collection)
@@ -1772,7 +1738,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         boolean deserializeBinary,
         boolean recovery,
         boolean skipVals,
-        boolean canRemap,
         final boolean needVer
     ) {
         CacheOperationContext opCtx = ctx.operationContextPerCall();
@@ -1790,7 +1755,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             forcePrimary,
             skipVals ? null : expiryPolicy(opCtx != null ? opCtx.expiry() : null),
             skipVals,
-            canRemap,
             needVer);
     }
 
@@ -1806,7 +1770,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @param forcePrimary Froce primary.
      * @param expiry Expiry policy.
      * @param skipVals Skip values.
-     * @param canRemap Can remap flag.
      * @param needVer Need version.
      * @return Future for the get operation.
      * @see GridCacheAdapter#getAllAsync(Collection)
@@ -1822,7 +1785,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         final boolean forcePrimary,
         @Nullable IgniteCacheExpiryPolicy expiry,
         final boolean skipVals,
-        boolean canRemap,
         final boolean needVer
     ) {
         ctx.checkSecurity(SecurityPermission.CACHE_READ);
@@ -1841,7 +1803,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             skipVals,
             /*keep cache objects*/false,
             recovery,
-            canRemap,
             needVer);
     }
 
@@ -1856,7 +1817,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @param expiry Expiry policy.
      * @param skipVals Skip values flag.
      * @param keepCacheObjects Keep cache objects.
-     * @param canRemap Can remap flag.
      * @param needVer If {@code true} returns values as tuples containing value and version.
      * @return Future.
      */
@@ -1872,7 +1832,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         final boolean skipVals,
         final boolean keepCacheObjects,
         final boolean recovery,
-        boolean canRemap,
         final boolean needVer
     ) {
         if (F.isEmpty(keys))
@@ -1894,9 +1853,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         if (tx == null || tx.implicit()) {
             Map<KeyCacheObject, EntryGetResult> misses = null;
 
-            final AffinityTopologyVersion topVer = tx == null ?
-                (canRemap ?
-                    ctx.affinity().affinityTopologyVersion() : ctx.shared().exchange().readyAffinityVersion()) :
+            final AffinityTopologyVersion topVer = tx == null ? ctx.affinity().affinityTopologyVersion() :
                 tx.topologyVersion();
 
             try {
@@ -4559,8 +4516,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 null,
                 taskName,
                 deserializeBinary,
-                /*can remap*/false,
-                true, needVer).get();
+                /*skip vals*/false,
+                needVer).get();
         }
         catch (IgniteException e) {
             if (e.getCause(IgniteCheckedException.class) != null)
@@ -4592,8 +4549,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             null,
             taskName,
             deserializeBinary,
-            /*can remap*/false,
-            true, needVer);
+            /*skip vals*/false,
+            needVer);
     }
 
     /**
@@ -4619,7 +4576,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             deserializeBinary,
             opCtx != null && opCtx.recovery(),
             /*skip vals*/false,
-            /*can remap*/true,
             needVer).get();
     }
 
@@ -4645,7 +4601,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             deserializeBinary,
             recovery,
             /*skip vals*/false,
-            /*can remap*/true,
             needVer);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index d81b9f7..30edbea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -346,18 +346,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Override public V getTopologySafe(K key) throws IgniteCheckedException {
-        CacheOperationContext prev = gate.enter(opCtx);
-
-        try {
-            return delegate.getTopologySafe(key);
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
     @Override public IgniteInternalFuture<V> getAsync(K key) {
         CacheOperationContext prev = gate.enter(opCtx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 22bd676..361764e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -92,14 +92,6 @@ public interface IgniteCacheProxy<K, V> extends IgniteCache<K, V>, Externalizabl
     public void closeProxy();
 
     /**
-     * Gets value without waiting for topology changes.
-     *
-     * @param key Key.
-     * @return Value.
-     */
-    public V getTopologySafe(K key);
-
-    /**
      * @return Future that contains cache destroy operation.
      */
     public IgniteFuture<?> destroyAsync();

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
index 3056361..ae1c6f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
@@ -1726,22 +1726,6 @@ public class IgniteCacheProxyImpl<K, V> extends AsyncSupportAdapter<IgniteCache<
     }
 
     /**
-     * Gets value without waiting for toplogy changes.
-     *
-     * @param key Key.
-     * @return Value.
-     */
-    @Override
-    public V getTopologySafe(K key) {
-        try {
-            return delegate.getTopologySafe(key);
-        }
-        catch (IgniteCheckedException | IgniteException e) {
-            throw cacheException(e);
-        }
-    }
-
-    /**
      * Throws {@code IgniteCacheRestartingException} if proxy is restarting.
      */
     public void checkRestart() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
index 2f4a40e..d01d536 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
@@ -1810,15 +1810,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
     public IgniteInternalFuture<?> localLoadCacheAsync(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args);
 
     /**
-     * Gets value without waiting for toplogy changes.
-     *
-     * @param key Key.
-     * @return Value.
-     * @throws IgniteCheckedException If failed.
-     */
-    public V getTopologySafe(K key) throws IgniteCheckedException;
-
-    /**
      * @param topVer Locked topology version.
      * @param key Key.
      * @param entryProcessor Entry processor.

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/CacheDistributedGetFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/CacheDistributedGetFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/CacheDistributedGetFutureAdapter.java
index 679732b..2257c9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/CacheDistributedGetFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/CacheDistributedGetFutureAdapter.java
@@ -92,7 +92,7 @@ public abstract class CacheDistributedGetFutureAdapter<K, V> extends GridCacheCo
     protected IgniteCacheExpiryPolicy expiryPlc;
 
     /** Flag indicating that get should be done on a locked topology version. */
-    protected boolean canRemap;
+    protected boolean canRemap = true;
 
     /** */
     protected final boolean needVer;
@@ -114,7 +114,6 @@ public abstract class CacheDistributedGetFutureAdapter<K, V> extends GridCacheCo
      * @param deserializeBinary Deserialize binary flag.
      * @param expiryPlc Expiry policy.
      * @param skipVals Skip values flag.
-     * @param canRemap Flag indicating whether future can be remapped on a newer topology version.
      * @param needVer If {@code true} returns values as tuples containing value and version.
      * @param keepCacheObjects Keep cache objects flag.
      */
@@ -128,7 +127,6 @@ public abstract class CacheDistributedGetFutureAdapter<K, V> extends GridCacheCo
         boolean deserializeBinary,
         @Nullable IgniteCacheExpiryPolicy expiryPlc,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer,
         boolean keepCacheObjects,
         boolean recovery
@@ -146,7 +144,6 @@ public abstract class CacheDistributedGetFutureAdapter<K, V> extends GridCacheCo
         this.deserializeBinary = deserializeBinary;
         this.expiryPlc = expiryPlc;
         this.skipVals = skipVals;
-        this.canRemap = canRemap;
         this.needVer = needVer;
         this.keepCacheObjects = keepCacheObjects;
         this.recovery = recovery;

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 1f67c1d..bbb2c5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -735,7 +735,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
         boolean deserializeBinary,
         boolean recovery,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer
     ) {
         CacheOperationContext opCtx = ctx.operationContextPerCall();
@@ -751,7 +750,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
             forcePrimary,
             null,
             skipVals,
-            canRemap,
             needVer);
     }
 
@@ -763,7 +761,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
      * @param taskName Task name.
      * @param expiry Expiry policy.
      * @param skipVals Skip values flag.
-     * @param canRemap Can remap flag.
      * @return Get future.
      */
     IgniteInternalFuture<Map<KeyCacheObject, EntryGetResult>> getDhtAllAsync(
@@ -774,7 +771,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
         boolean skipVals,
-        boolean canRemap,
         boolean recovery
     ) {
         return getAllAsync0(keys,
@@ -788,7 +784,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
             skipVals,
             /*keep cache objects*/true,
             recovery,
-            canRemap,
             /*need version*/true);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index 8430f84..4319374 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@ -422,7 +422,6 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
                 taskName,
                 expiryPlc,
                 skipVals,
-                /*can remap*/true,
                 recovery);
         }
         else {
@@ -446,7 +445,6 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
                             taskName,
                             expiryPlc,
                             skipVals,
-                            /*can remap*/true,
                             recovery);
                     }
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
index 439bb9d..7c6c020 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
@@ -365,7 +365,6 @@ public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCa
                 taskName,
                 expiryPlc,
                 skipVals,
-                /*can remap*/true,
                 recovery);
         }
         else {
@@ -391,7 +390,6 @@ public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCa
                                 taskName,
                                 expiryPlc,
                                 skipVals,
-                                /*can remap*/true,
                                 recovery);
 
                         fut0.listen(createGetFutureListener());

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/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 e7e0e06..73c0ea5 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
@@ -73,29 +73,24 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
     /** Logger. */
     private static IgniteLogger log;
 
-    /** Topology version. */
-    private AffinityTopologyVersion topVer;
-
     /**
      * @param cctx Context.
      * @param keys Keys.
-     * @param topVer Topology version.
      * @param readThrough Read through flag.
      * @param forcePrimary If {@code true} then will force network trip to primary node even
      *          if called on backup node.
      * @param subjId Subject ID.
      * @param taskName Task name.
      * @param deserializeBinary Deserialize binary flag.
+     * @param recovery Recovery mode flag.
      * @param expiryPlc Expiry policy.
      * @param skipVals Skip values flag.
-     * @param canRemap Flag indicating whether future can be remapped on a newer topology version.
      * @param needVer If {@code true} returns values as tuples containing value and version.
      * @param keepCacheObjects Keep cache objects flag.
      */
     public GridPartitionedGetFuture(
         GridCacheContext<K, V> cctx,
         Collection<KeyCacheObject> keys,
-        AffinityTopologyVersion topVer,
         boolean readThrough,
         boolean forcePrimary,
         @Nullable UUID subjId,
@@ -104,7 +99,6 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
         boolean recovery,
         @Nullable IgniteCacheExpiryPolicy expiryPlc,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer,
         boolean keepCacheObjects
     ) {
@@ -117,21 +111,20 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
             deserializeBinary,
             expiryPlc,
             skipVals,
-            canRemap,
             needVer,
             keepCacheObjects,
             recovery);
 
-        this.topVer = topVer;
-
         if (log == null)
             log = U.logger(cctx.kernalContext(), logRef, GridPartitionedGetFuture.class);
     }
 
     /**
      * Initializes future.
+     *
+     * @param topVer Topology version.
      */
-    public void init() {
+    public void init(AffinityTopologyVersion topVer) {
         AffinityTopologyVersion lockedTopVer = cctx.shared().lockedTopologyVersion(null);
 
         if (lockedTopVer != null) {
@@ -140,7 +133,7 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
             map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), lockedTopVer);
         }
         else {
-            AffinityTopologyVersion topVer = this.topVer.topologyVersion() > 0 ? this.topVer :
+            topVer = topVer.topologyVersion() > 0 ? topVer :
                 canRemap ? cctx.affinity().affinityTopologyVersion() : cctx.shared().exchange().readyAffinityVersion();
 
             map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer);
@@ -402,7 +395,7 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
         boolean fastLocGet = (!forcePrimary || affNodes.get(0).isLocal()) &&
             cctx.allowFastLocalRead(part, affNodes, topVer);
 
-        if (fastLocGet && localGet(key, part, locVals))
+        if (fastLocGet && localGet(topVer, key, part, locVals))
             return false;
 
         ClusterNode node = affinityNode(affNodes);
@@ -438,12 +431,13 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
     }
 
     /**
+     * @param topVer Topology version.
      * @param key Key.
      * @param part Partition.
      * @param locVals Local values.
      * @return {@code True} if there is no need to further search value.
      */
-    private boolean localGet(KeyCacheObject key, int part, Map<K, V> locVals) {
+    private boolean localGet(AffinityTopologyVersion topVer, KeyCacheObject key, int part, Map<K, V> locVals) {
         assert cctx.affinityNode() : this;
 
         GridDhtCacheAdapter<K, V> cache = cache();

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index 0828a80..234ee91 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -133,7 +133,6 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
      * @param deserializeBinary Deserialize binary flag.
      * @param expiryPlc Expiry policy.
      * @param skipVals Skip values flag.
-     * @param canRemap Flag indicating whether future can be remapped on a newer topology version.
      * @param needVer If {@code true} returns values as tuples containing value and version.
      * @param keepCacheObjects Keep cache objects flag.
      */
@@ -148,7 +147,6 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
         boolean deserializeBinary,
         @Nullable IgniteCacheExpiryPolicy expiryPlc,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer,
         boolean keepCacheObjects,
         boolean recovery
@@ -162,6 +160,8 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
 
             canRemap = false;
         }
+        else
+            canRemap = true;
 
         this.cctx = cctx;
         this.key = key;
@@ -172,7 +172,6 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
         this.deserializeBinary = deserializeBinary;
         this.expiryPlc = expiryPlc;
         this.skipVals = skipVals;
-        this.canRemap = canRemap;
         this.needVer = needVer;
         this.keepCacheObjects = keepCacheObjects;
         this.recovery = recovery;

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index a50a707..30614a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -439,50 +439,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         return near;
     }
 
-    /**
-     *  @param key Key.
-     *  @param deserializeBinary Deserialize binary.
-     *  @param needVer Need version.
-     *  @return Value.
-     *  @throws IgniteCheckedException If failed.
-     */
-    @Nullable public V get0(K key, boolean deserializeBinary, boolean needVer) throws IgniteCheckedException {
-        ctx.checkSecurity(SecurityPermission.CACHE_READ);
-
-        if (keyCheck)
-            validateCacheKey(key);
-
-        String taskName = ctx.kernalContext().job().currentTaskName();
-
-        CacheOperationContext opCtx = ctx.operationContextPerCall();
-
-        UUID subjId = ctx.subjectIdPerCall(null, opCtx);
-
-        final ExpiryPolicy expiryPlc = opCtx != null ? opCtx.expiry() : null;
-
-        final boolean skipStore = opCtx != null && opCtx.skipStore();
-
-        try {
-            return getAsync0(ctx.toCacheKeyObject(key),
-                !ctx.config().isReadFromBackup(),
-                subjId,
-                taskName,
-                deserializeBinary,
-                opCtx != null && opCtx.recovery(),
-                expiryPlc,
-                false,
-                skipStore,
-                true,
-                needVer).get();
-        }
-        catch (IgniteException e) {
-            if (e.getCause(IgniteCheckedException.class) != null)
-                throw e.getCause(IgniteCheckedException.class);
-            else
-                throw e;
-        }
-    }
-
     /** {@inheritDoc} */
     @Override protected IgniteInternalFuture<V> getAsync(
         final K key,
@@ -492,7 +448,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         final String taskName,
         final boolean deserializeBinary,
         final boolean skipVals,
-        final boolean canRemap,
         final boolean needVer
     ) {
         ctx.checkSecurity(SecurityPermission.CACHE_READ);
@@ -520,7 +475,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                     expiryPlc,
                     skipVals,
                     skipStore,
-                    canRemap,
                     needVer);
             }
         });
@@ -538,7 +492,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             deserializeBinary,
             opCtx != null && opCtx.recovery(),
             false,
-            true,
             needVer,
             false).get();
     }
@@ -553,7 +506,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         final boolean deserializeBinary,
         final boolean recovery,
         final boolean skipVals,
-        final boolean canRemap,
         final boolean needVer
     ) {
         return getAllAsyncInternal(keys,
@@ -563,7 +515,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             deserializeBinary,
             recovery,
             skipVals,
-            canRemap,
             needVer,
             true);
     }
@@ -575,7 +526,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param taskName Task name.
      * @param deserializeBinary Deserialize binary flag.
      * @param skipVals Skip values flag.
-     * @param canRemap Can remap flag.
      * @param needVer Need version flag.
      * @param asyncOp Async operation flag.
      * @return Future.
@@ -588,7 +538,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         final boolean deserializeBinary,
         final boolean recovery,
         final boolean skipVals,
-        final boolean canRemap,
         final boolean needVer,
         boolean asyncOp
     ) {
@@ -622,7 +571,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                         expiryPlc,
                         skipVals,
                         skipStore,
-                        canRemap,
                         needVer);
                 }
             });
@@ -637,7 +585,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                 expiryPlc,
                 skipVals,
                 skipStore,
-                canRemap,
                 needVer);
         }
     }
@@ -1409,7 +1356,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param expiryPlc Expiry policy.
      * @param skipVals Skip values flag.
      * @param skipStore Skip store flag.
-     * @param canRemap Can remap flag.
      * @param needVer Need version.
      * @return Get future.
      */
@@ -1422,11 +1368,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable ExpiryPolicy expiryPlc,
         boolean skipVals,
         boolean skipStore,
-        boolean canRemap,
         boolean needVer
     ) {
-        AffinityTopologyVersion topVer = canRemap ? ctx.affinity().affinityTopologyVersion() :
-            ctx.shared().exchange().readyAffinityVersion();
+        AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
 
         IgniteCacheExpiryPolicy expiry = skipVals ? null : expiryPolicy(expiryPlc);
 
@@ -1440,7 +1384,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             deserializeBinary,
             expiry,
             skipVals,
-            canRemap,
             needVer,
             false,
             recovery);
@@ -1473,11 +1416,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable ExpiryPolicy expiryPlc,
         boolean skipVals,
         boolean skipStore,
-        boolean canRemap,
         boolean needVer
     ) {
-        AffinityTopologyVersion topVer = canRemap ? ctx.affinity().affinityTopologyVersion() :
-            ctx.shared().exchange().readyAffinityVersion();
+        AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
 
         final IgniteCacheExpiryPolicy expiry = skipVals ? null : expiryPolicy(expiryPlc);
 
@@ -1640,7 +1581,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         // Either reload or not all values are available locally.
         GridPartitionedGetFuture<K, V> fut = new GridPartitionedGetFuture<>(ctx,
             keys,
-            topVer,
             !skipStore,
             forcePrimary,
             subjId,
@@ -1649,11 +1589,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             recovery,
             expiry,
             skipVals,
-            canRemap,
             needVer,
             false);
 
-        fut.init();
+        fut.init(topVer);
 
         return fut;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index 8449f3a..edb4278 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -179,7 +179,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
         String taskName,
         final boolean deserializeBinary,
         final boolean skipVals,
-        boolean canRemap,
         final boolean needVer) {
         ctx.checkSecurity(SecurityPermission.CACHE_READ);
 
@@ -226,9 +225,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
             }, opCtx, /*retry*/false);
         }
 
-        AffinityTopologyVersion topVer = tx == null ?
-            (canRemap ? ctx.affinity().affinityTopologyVersion() : ctx.shared().exchange().readyAffinityVersion()) :
-            tx.topologyVersion();
+        AffinityTopologyVersion topVer = tx == null ? ctx.affinity().affinityTopologyVersion() : tx.topologyVersion();
 
         subjId = ctx.subjectIdPerCall(subjId, opCtx);
 
@@ -242,7 +239,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
             deserializeBinary,
             skipVals ? null : expiryPolicy(opCtx != null ? opCtx.expiry() : null),
             skipVals,
-            canRemap,
             needVer,
             /*keepCacheObjects*/false,
             opCtx != null && opCtx.recovery());
@@ -262,7 +258,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
         final boolean deserializeBinary,
         final boolean recovery,
         final boolean skipVals,
-        boolean canRemap,
         final boolean needVer
     ) {
         ctx.checkSecurity(SecurityPermission.CACHE_READ);
@@ -293,9 +288,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
             }, opCtx, /*retry*/false);
         }
 
-        AffinityTopologyVersion topVer = tx == null ?
-            (canRemap ? ctx.affinity().affinityTopologyVersion() : ctx.shared().exchange().readyAffinityVersion()) :
-            tx.topologyVersion();
+        AffinityTopologyVersion topVer = tx == null ? ctx.affinity().affinityTopologyVersion() : tx.topologyVersion();
 
         subjId = ctx.subjectIdPerCall(subjId, opCtx);
 
@@ -310,7 +303,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
             recovery,
             skipVals ? null : expiryPolicy(opCtx != null ? opCtx.expiry() : null),
             skipVals,
-            canRemap,
             needVer);
     }
 
@@ -324,7 +316,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
      * @param deserializeBinary Deserialize binary flag.
      * @param expiryPlc Expiry policy.
      * @param skipVals Skip values flag.
-     * @param canRemap Can remap flag.
      * @param needVer Need version.
      * @return Loaded values.
      */
@@ -339,7 +330,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
         boolean recovery,
         @Nullable IgniteCacheExpiryPolicy expiryPlc,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer) {
         return loadAsync(keys,
             readThrough,
@@ -350,7 +340,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
             recovery,
             expiryPlc,
             skipVals,
-            canRemap,
             needVer,
             false);
     }
@@ -365,7 +354,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
      * @param deserializeBinary Deserialize binary flag.
      * @param expiryPlc Expiry policy.
      * @param skipVals Skip values flag.
-     * @param canRemap Flag indicating whether future can be remapped on a newer topology version.
      * @param needVer If {@code true} returns values as tuples containing value and version.
      * @param keepCacheObj Keep cache objects flag.
      * @return Load future.
@@ -380,7 +368,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
         boolean deserializeBinary,
         @Nullable IgniteCacheExpiryPolicy expiryPlc,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer,
         boolean keepCacheObj,
         boolean recovery
@@ -395,7 +382,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
             deserializeBinary,
             expiryPlc,
             skipVals,
-            canRemap,
             needVer,
             keepCacheObj,
             recovery);
@@ -415,7 +401,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
      * @param deserializeBinary Deserialize binary flag.
      * @param expiryPlc Expiry policy.
      * @param skipVals Skip values flag.
-     * @param canRemap Flag indicating whether future can be remapped on a newer topology version.
      * @param needVer If {@code true} returns values as tuples containing value and version.
      * @param keepCacheObj Keep cache objects flag.
      * @return Load future.
@@ -431,7 +416,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
         boolean recovery,
         @Nullable IgniteCacheExpiryPolicy expiryPlc,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer,
         boolean keepCacheObj
     ) {
@@ -607,7 +591,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
         GridPartitionedGetFuture<K, V> fut = new GridPartitionedGetFuture<>(
             ctx,
             keys,
-            topVer,
             readThrough,
             forcePrimary,
             subjId,
@@ -616,11 +599,10 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
             recovery,
             expiryPlc,
             skipVals,
-            canRemap,
             needVer,
             keepCacheObj);
 
-        fut.init();
+        fut.init(topVer);
 
         return fut;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index e6c5c10..2f832b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -405,7 +405,6 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
         boolean deserializeBinary,
         boolean recovery,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer
     ) {
         ctx.checkSecurity(SecurityPermission.CACHE_READ);
@@ -430,7 +429,6 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
             skipVals ? null : opCtx != null ? opCtx.expiry() : null,
             skipVals,
             opCtx != null && opCtx.skipStore(),
-            canRemap,
             needVer);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/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 428355c..672693c 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
@@ -216,7 +216,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
      * @param expiryPlc Expiry policy.
      * @param skipVal Skip value flag.
      * @param skipStore Skip store flag.
-     * @param canRemap Can remap flag.
      * @param needVer Need version.
      * @return Loaded values.
      */
@@ -231,7 +230,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
         @Nullable ExpiryPolicy expiryPlc,
         boolean skipVal,
         boolean skipStore,
-        boolean canRemap,
         boolean needVer
     ) {
         if (F.isEmpty(keys))
@@ -251,7 +249,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
             deserializeBinary,
             expiry,
             skipVal,
-            canRemap,
             needVer,
             false,
             recovery);

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
index ce728b5..ea52766 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
@@ -331,7 +331,6 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
             null,
             false,
             /*skip store*/false,
-            /*can remap*/true,
             false
         ).get().get(keyValue(false));
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/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 1ab56a4..807270d 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
@@ -93,7 +93,6 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
      * @param deserializeBinary Deserialize binary flag.
      * @param expiryPlc Expiry policy.
      * @param skipVals Skip values flag.
-     * @param canRemap Flag indicating whether future can be remapped on a newer topology version.
      * @param needVer If {@code true} returns values as tuples containing value and version.
      * @param keepCacheObjects Keep cache objects flag.
      */
@@ -108,7 +107,6 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
         boolean deserializeBinary,
         @Nullable IgniteCacheExpiryPolicy expiryPlc,
         boolean skipVals,
-        boolean canRemap,
         boolean needVer,
         boolean keepCacheObjects,
         boolean recovery
@@ -122,7 +120,6 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
             deserializeBinary,
             expiryPlc,
             skipVals,
-            canRemap,
             needVer,
             keepCacheObjects,
             recovery);

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
index a13da3d..0c5f43d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
@@ -122,7 +122,6 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
         final boolean deserializeBinary,
         final boolean recovery,
         final boolean skipVals,
-        boolean canRemap,
         final boolean needVer
     ) {
         ctx.checkSecurity(SecurityPermission.CACHE_READ);
@@ -167,7 +166,6 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
             skipVals ? null : opCtx != null ? opCtx.expiry() : null,
             skipVals,
             skipStore,
-            canRemap,
             needVer);
     }
 
@@ -202,7 +200,6 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
             deserializeBinary,
             expiryPlc,
             skipVals,
-            /*can remap*/true,
             needVer,
             /*keepCacheObjects*/true,
             recovery);

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index 8b043d8..e73f34b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -2513,7 +2513,6 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements GridTimeou
                     /*deserializeBinary*/false,
                     expiryPlc0,
                     skipVals,
-                    /*can remap*/true,
                     needVer,
                     /*keepCacheObject*/true,
                     recovery
@@ -2546,7 +2545,6 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements GridTimeou
                     recovery,
                     expiryPlc0,
                     skipVals,
-                    /*can remap*/true,
                     needVer,
                     /*keepCacheObject*/true
                 ).chain(new C1<IgniteInternalFuture<Map<Object, Object>>, Void>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 1be264d..40d1fac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -340,7 +340,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
         final boolean deserializeBinary,
         boolean recovery,
         final boolean skipVals,
-        boolean canRemap,
         final boolean needVer
     ) {
         A.notNull(keys, "keys");
@@ -543,7 +542,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
             /*force primary*/false,
             expiry,
             skipVals,
-            /*can remap*/true,
             needVer).get();
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTopologySafeGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTopologySafeGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTopologySafeGetSelfTest.java
deleted file mode 100644
index 0140000..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTopologySafeGetSelfTest.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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;
-
-import java.util.Collection;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-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.apache.ignite.transactions.Transaction;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
-
-/**
- *
- */
-public class IgniteCacheTopologySafeGetSelfTest extends GridCommonAbstractTest {
-    /** Number of initial grids. */
-    public static final int GRID_CNT = 4;
-
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** TX commit latch. */
-    private CountDownLatch releaseLatch;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        cfg.setCacheConfiguration(
-            cacheCfg("tx", TRANSACTIONAL, false),
-            cacheCfg("atomic", ATOMIC, false),
-            cacheCfg("tx_near", TRANSACTIONAL, true),
-            cacheCfg("atomic_near", ATOMIC, true));
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        return cfg;
-    }
-
-    /**
-     * @param name Cache name.
-     * @param cacheMode Cache mode.
-     * @param near Near enabled flag.
-     * @return Cache configuration.
-     */
-    @SuppressWarnings("unchecked")
-    private CacheConfiguration cacheCfg(String name, CacheAtomicityMode cacheMode, boolean near) {
-        CacheConfiguration cfg = new CacheConfiguration(name);
-
-        cfg.setAtomicityMode(cacheMode);
-        cfg.setBackups(1);
-
-        if (near)
-            cfg.setNearConfiguration(new NearCacheConfiguration());
-        else
-            cfg.setNearConfiguration(null);
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetTopologySafeNodeJoin() throws Exception {
-        checkGetTopologySafeNodeJoin(false);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetTopologySafeNodeJoinPrimaryLeave() throws Exception {
-        checkGetTopologySafeNodeJoin(true);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void checkGetTopologySafeNodeJoin(boolean failPrimary) throws Exception {
-        startGrids(GRID_CNT);
-
-        awaitPartitionMapExchange();
-
-        try {
-            ClusterNode targetNode = ignite(1).cluster().localNode();
-
-            info(">>> Target node: " + targetNode.id());
-
-            // Populate caches with a key that does not belong to ignite(0).
-            int key = -1;
-            for (int i = 0; i < 100; i++) {
-                Collection<ClusterNode> nodes = ignite(0).affinity("tx").mapKeyToPrimaryAndBackups(i);
-                ClusterNode primaryNode = F.first(nodes);
-
-                if (!nodes.contains(ignite(0).cluster().localNode()) && primaryNode.id().equals(targetNode.id())) {
-                    ignite(1).cache("tx").put(i, i);
-                    ignite(1).cache("atomic").put(i, i);
-                    ignite(1).cache("tx_near").put(i, i);
-                    ignite(1).cache("atomic_near").put(i, i);
-
-                    key = i;
-
-
-                    break;
-                }
-            }
-
-            assertTrue(key != -1);
-
-            IgniteInternalFuture<?> txFut = startBlockingTxAsync();
-
-            IgniteInternalFuture<?> nodeFut = startNodeAsync();
-
-            if (failPrimary)
-                stopGrid(getTestIgniteInstanceName(1), false, false);
-
-            assertEquals(key, ((IgniteKernal)ignite(0)).internalCache("tx").getTopologySafe(key));
-            assertEquals(key, ((IgniteKernal)ignite(0)).internalCache("atomic").getTopologySafe(key));
-            assertEquals(key, ((IgniteKernal)ignite(0)).internalCache("tx_near").getTopologySafe(key));
-            assertEquals(key, ((IgniteKernal)ignite(0)).internalCache("atomic_near").getTopologySafe(key));
-
-            releaseTx();
-
-            txFut.get();
-            nodeFut.get();
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * @return Future.
-     * @throws Exception If failed.
-     */
-    private IgniteInternalFuture<?> startNodeAsync() throws Exception {
-        IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                startGrid(GRID_CNT);
-
-                return null;
-            }
-        });
-
-        U.sleep(1000);
-
-        return fut;
-    }
-
-    /**
-     * @return TX release future.
-     * @throws Exception If failed.
-     */
-    private IgniteInternalFuture<?> startBlockingTxAsync() throws Exception {
-        final CountDownLatch lockLatch = new CountDownLatch(1);
-
-        IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                try (Transaction ignore = ignite(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                    for (int i = 0; i < 30; i++)
-                        ignite(0).cache("tx").get("value-" + i);
-
-                    releaseLatch = new CountDownLatch(1);
-
-                    lockLatch.countDown();
-
-                    releaseLatch.await();
-                }
-
-                return null;
-            }
-        });
-
-        lockLatch.await();
-
-        return fut;
-    }
-
-    /**
-     *
-     */
-    private void releaseTx() {
-        assert releaseLatch != null;
-
-        releaseLatch.countDown();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
index 34eb295..7357d7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
@@ -20,7 +20,6 @@ package org.apache.ignite.testsuites;
 import java.util.Set;
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.GridCacheIncrementTransformTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheTopologySafeGetSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicNodeJoinTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheSizeFailoverTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheTxNearDisabledPutGetRestartTest;
@@ -83,7 +82,6 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
 
         suite.addTestSuite(IgniteCacheSizeFailoverTest.class);
 
-        suite.addTestSuite(IgniteCacheTopologySafeGetSelfTest.class);
         suite.addTestSuite(IgniteAtomicLongChangingTopologySelfTest.class);
 
         suite.addTestSuite(GridCacheTxNodeFailureSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/aefa9a8a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
index aa1f83b..0fc2c2d 100644
--- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
@@ -648,11 +648,6 @@ public class HibernateCacheProxy implements IgniteInternalCache<Object, Object>
     }
 
     /** {@inheritDoc} */
-    @Override public Object getTopologySafe(Object key) throws IgniteCheckedException {
-        return delegate.getTopologySafe(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
     @Override public Collection<Integer> lostPartitions() {
         return delegate.lostPartitions();
     }


[06/17] ignite git commit: IGNITE-6053: IgniteCache.clear clears local caches with same names on all server nodes. - Fixes #2443.

Posted by sb...@apache.org.
IGNITE-6053: IgniteCache.clear clears local caches with same names on all server nodes. - Fixes #2443.

Signed-off-by: shroman <rs...@yahoo.com>


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

Branch: refs/heads/ignite-3479
Commit: 6aa94a9ae1eb52546385e5ba0027c09172873175
Parents: 7ecdd7d
Author: shroman <rs...@yahoo.com>
Authored: Mon Sep 25 12:59:51 2017 +0900
Committer: shroman <rs...@yahoo.com>
Committed: Mon Sep 25 12:59:51 2017 +0900

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 62 ++++++++++++----
 .../local/GridCacheLocalFullApiSelfTest.java    | 76 +++++++++++++++++++-
 2 files changed, 123 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6aa94a9a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 32b1b99..c7e40ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -383,6 +383,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /**
      * Increments map public size.
+     *
      * @param e Map entry.
      */
     public void incrementSize(GridCacheMapEntry e) {
@@ -391,6 +392,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /**
      * Decrements map public size.
+     *
      * @param e Map entry.
      */
     public void decrementSize(GridCacheMapEntry e) {
@@ -1114,8 +1116,16 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @throws IgniteCheckedException In case of error.
      */
     private void clear(@Nullable Set<? extends K> keys) throws IgniteCheckedException {
-        executeClearTask(keys, false).get();
-        executeClearTask(keys, true).get();
+        if (isLocal()) {
+            if (keys == null)
+                clearLocally(true, false, false);
+            else
+                clearLocallyAll(keys, true, false, false);
+        }
+        else {
+            executeClearTask(keys, false).get();
+            executeClearTask(keys, true).get();
+        }
     }
 
     /**
@@ -1123,13 +1133,33 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @return Future.
      */
     private IgniteInternalFuture<?> clearAsync(@Nullable final Set<? extends K> keys) {
-        return executeClearTask(keys, false).chain(new CX1<IgniteInternalFuture<?>, Object>() {
-            @Override public Object applyx(IgniteInternalFuture<?> fut) throws IgniteCheckedException {
-                executeClearTask(keys, true).get();
+        if (isLocal())
+            return clearLocallyAsync(keys);
+        else
+            return executeClearTask(keys, false).chain(new CX1<IgniteInternalFuture<?>, Object>() {
+                @Override public Object applyx(IgniteInternalFuture<?> fut) throws IgniteCheckedException {
+                    executeClearTask(keys, true).get();
+
+                    return null;
+                }
+            });
+    }
+
+    /**
+     * @param keys Keys to clear.
+     * @return Clear future.
+     */
+    private IgniteInternalFuture<?> clearLocallyAsync(@Nullable final Set<? extends K> keys) {
+        return ctx.closures().callLocalSafe(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                if (keys == null)
+                    clearLocally(true, false, false);
+                else
+                    clearLocallyAll(keys, true, false, false);
 
                 return null;
             }
-        });
+        }, false);
     }
 
     /**
@@ -3670,8 +3700,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     /**
      * @param p Predicate.
      * @param args Arguments.
-     * @throws IgniteCheckedException If failed.
      * @return Load cache future.
+     * @throws IgniteCheckedException If failed.
      */
     IgniteInternalFuture<?> globalLoadCacheAsync(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args)
         throws IgniteCheckedException {
@@ -3693,7 +3723,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 new LoadCacheJobV2<>(ctx.name(), ctx.affinity().affinityTopologyVersion(), p, args, plc, keepBinary)),
             nodes);
 
-
         return fut;
     }
 
@@ -5995,7 +6024,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param metrics Metrics.
-         * @param start   Start time.
+         * @param start Start time.
          */
         public UpdateTimeStatClosure(CacheMetricsImpl metrics, long start) {
             this.metrics = metrics;
@@ -6031,7 +6060,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param metrics Metrics.
-         * @param start   Start time.
+         * @param start Start time.
          */
         public UpdateGetTimeStatClosure(CacheMetricsImpl metrics, long start) {
             super(metrics, start);
@@ -6052,7 +6081,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param metrics Metrics.
-         * @param start   Start time.
+         * @param start Start time.
          */
         public UpdateRemoveTimeStatClosure(CacheMetricsImpl metrics, long start) {
             super(metrics, start);
@@ -6073,7 +6102,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param metrics Metrics.
-         * @param start   Start time.
+         * @param start Start time.
          */
         public UpdatePutTimeStatClosure(CacheMetricsImpl metrics, long start) {
             super(metrics, start);
@@ -6094,7 +6123,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param metrics Metrics.
-         * @param start   Start time.
+         * @param start Start time.
          */
         public UpdatePutAndGetTimeStatClosure(CacheMetricsImpl metrics, long start) {
             super(metrics, start);
@@ -6493,6 +6522,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * Constructor.
+         *
          * @param internalIterator Internal iterator.
          * @param keepBinary Keep binary flag.
          */
@@ -6541,6 +6571,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * Constructor
+         *
          * @param internalSet Internal set.
          */
         private KeySet(Set<GridCacheMapEntry> internalSet) {
@@ -6585,6 +6616,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * Constructor.
+         *
          * @param internalIterator Internal iterator.
          * @param keepBinary Keep binary.
          */
@@ -6632,7 +6664,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         /** Keep binary flag. */
         private final boolean keepBinary;
 
-        /** Constructor.
+        /**
+         * Constructor.
+         *
          * @param internalSet Internal set.
          * @param keepBinary Keep binary flag.
          */

http://git-wip-us.apache.org/repos/asf/ignite/blob/6aa94a9a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
index 8cb9369..aaf69c9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
@@ -17,7 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache.local;
 
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.Map;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheMode;
@@ -79,4 +81,76 @@ public class GridCacheLocalFullApiSelfTest extends GridCacheAbstractFullApiSelfT
         for (String key : keys)
             assert "key1".equals(key) || "key2".equals(key);
     }
-}
\ No newline at end of file
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLocalClearAsync() throws Exception {
+        localCacheClear(true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLocalClear() throws Exception {
+        localCacheClear(false);
+    }
+
+    /**
+     * @param async If {@code true} uses async method.
+     * @throws Exception If failed.
+     */
+    private void localCacheClear(boolean async) throws Exception {
+        // In addition to the existing tests, it confirms the data is cleared only on one node,
+        // not on all nodes that have local caches with same names.
+        try {
+            startGrid(1);
+
+            IgniteCache<String, Integer> cache = jcache();
+
+            for (int i = 0; i < 5; i++) {
+                cache.put(String.valueOf(i), i);
+                jcache(1).put(String.valueOf(i), i);
+            }
+
+            if (async)
+                cache.clearAsync("4").get();
+            else
+                cache.clear("4");
+
+            assertNull(peek(cache, "4"));
+            assertNotNull(peek(jcache(1), "4"));
+
+            if (async)
+                cache.clearAllAsync(new HashSet<>(Arrays.asList("2", "3"))).get();
+            else
+                cache.clearAll(new HashSet<>(Arrays.asList("2", "3")));
+
+            for (int i = 2; i < 4; i++) {
+                assertNull(peek(cache, String.valueOf(i)));
+                assertNotNull(peek(jcache(1), String.valueOf(i)));
+            }
+
+            if (async)
+                cache.clearAsync().get();
+            else
+                cache.clear();
+
+            for (int i = 0; i < 2; i++) {
+                assertNull(peek(cache, String.valueOf(i)));
+                assertNotNull(peek(jcache(1), String.valueOf(i)));
+            }
+
+            if (async)
+                jcache(1).clearAsync().get();
+            else
+                jcache(1).clear();
+
+            for (int i = 0; i < 2; i++)
+                assert jcache(i).localSize() == 0;
+        }
+        finally {
+            stopGrid(1);
+        }
+    }
+}


[08/17] ignite git commit: IGNITE-6249 .NET: IgniteConfiguration.ConsistentId

Posted by sb...@apache.org.
IGNITE-6249 .NET: IgniteConfiguration.ConsistentId

This closes #2727


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

Branch: refs/heads/ignite-3479
Commit: 68c100df28ddd97828fd67c2d46f6124ce080d4c
Parents: 6f1ca41
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 25 13:07:35 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 25 13:07:35 2017 +0300

----------------------------------------------------------------------
 .../utils/PlatformConfigurationUtils.java       | 10 +++
 .../IgniteConfigurationSerializerTest.cs        |  7 +-
 .../IgniteConfigurationTest.cs                  | 73 ++++++++++++++++++--
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  7 ++
 .../IgniteConfigurationSection.xsd              |  5 ++
 .../Common/IgniteConfigurationXmlSerializer.cs  |  4 +-
 6 files changed, 97 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/68c100df/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 7e17bdb..dc45166 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.platform.utils;
 
+import java.io.Serializable;
 import java.lang.management.ManagementFactory;
 import java.net.InetSocketAddress;
 import java.security.AccessController;
@@ -571,6 +572,14 @@ public class PlatformConfigurationUtils {
         if (in.readBoolean())
             cfg.setActiveOnStart(in.readBoolean());
 
+        Object consId = in.readObjectDetached();
+
+        if (consId instanceof Serializable) {
+            cfg.setConsistentId((Serializable) consId);
+        } else if (consId != null) {
+            throw new IgniteException("IgniteConfiguration.ConsistentId should be Serializable.");
+        }
+
         // Thread pools.
         if (in.readBoolean())
             cfg.setPublicThreadPoolSize(in.readInt());
@@ -1025,6 +1034,7 @@ public class PlatformConfigurationUtils {
         w.writeLong(cfg.getLongQueryWarningTimeout());
         w.writeBoolean(true);
         w.writeBoolean(cfg.isActiveOnStart());
+        w.writeObject(cfg.getConsistentId());
 
         // Thread pools.
         w.writeBoolean(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/68c100df/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index ac214ce..23ee884 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -68,7 +68,7 @@ namespace Apache.Ignite.Core.Tests
         [Test]
         public void TestPredefinedXml()
         {
-            var xml = @"<igniteConfig workDirectory='c:' JvmMaxMemoryMb='1024' MetricsLogFrequency='0:0:10' isDaemon='true' isLateAffinityAssignment='false' springConfigUrl='c:\myconfig.xml' autoGenerateIgniteInstanceName='true' peerAssemblyLoadingMode='CurrentAppDomain' longQueryWarningTimeout='1:2:3' isActiveOnStart='false'>
+            var xml = @"<igniteConfig workDirectory='c:' JvmMaxMemoryMb='1024' MetricsLogFrequency='0:0:10' isDaemon='true' isLateAffinityAssignment='false' springConfigUrl='c:\myconfig.xml' autoGenerateIgniteInstanceName='true' peerAssemblyLoadingMode='CurrentAppDomain' longQueryWarningTimeout='1:2:3' isActiveOnStart='false' consistentId='someId012'>
                             <localhost>127.1.1.1</localhost>
                             <binaryConfiguration compactFooter='false' keepDeserialized='true'>
                                 <nameMapper type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+NameMapper' bar='testBar' />
@@ -145,6 +145,7 @@ namespace Apache.Ignite.Core.Tests
                             <sqlConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
                             <clientConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
                             <persistentStoreConfiguration alwaysWriteFullPages='true' checkpointingFrequency='00:00:1' checkpointingPageBufferSize='2' checkpointingThreads='3' lockWaitTime='00:00:04' persistentStorePath='foo' tlbSize='5' walArchivePath='bar' walFlushFrequency='00:00:06' walFsyncDelayNanos='7' walHistorySize='8' walMode='None' walRecordIteratorBufferSize='9' walSegments='10' walSegmentSize='11' walStorePath='baz' metricsEnabled='true' rateTimeInterval='0:0:6' subIntervals='3' />
+                            <consistentId type='System.String'>someId012</consistentId>
                         </igniteConfig>";
 
             var cfg = IgniteConfiguration.FromXml(xml);
@@ -171,6 +172,7 @@ namespace Apache.Ignite.Core.Tests
             Assert.IsTrue(cfg.AutoGenerateIgniteInstanceName);
             Assert.AreEqual(new TimeSpan(1, 2, 3), cfg.LongQueryWarningTimeout);
             Assert.IsFalse(cfg.IsActiveOnStart);
+            Assert.AreEqual("someId012", cfg.ConsistentId);
 
             Assert.AreEqual("secondCache", cfg.CacheConfiguration.Last().Name);
 
@@ -927,7 +929,8 @@ namespace Apache.Ignite.Core.Tests
                     MetricsEnabled = true,
                     RateTimeInterval = TimeSpan.FromDays(1)
                 },
-                IsActiveOnStart = false
+                IsActiveOnStart = false,
+                ConsistentId = "myId123"
             };
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/68c100df/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index 5facb38..4f8014f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -47,10 +47,10 @@ namespace Apache.Ignite.Core.Tests
     public class IgniteConfigurationTest
     {
         /// <summary>
-        /// Fixture setup.
+        /// Fixture tear down.
         /// </summary>
         [TestFixtureSetUp]
-        public void FixtureSetUp()
+        public void FixtureTearDown()
         {
             Ignition.StopAll(true);
         }
@@ -195,6 +195,8 @@ namespace Apache.Ignite.Core.Tests
                 Assert.AreEqual(cfg.UtilityCacheThreadPoolSize, resCfg.UtilityCacheThreadPoolSize);
                 Assert.AreEqual(cfg.QueryThreadPoolSize, resCfg.QueryThreadPoolSize);
 
+                Assert.AreEqual(cfg.ConsistentId, resCfg.ConsistentId);
+
                 var binCfg = cfg.BinaryConfiguration;
                 Assert.IsFalse(binCfg.CompactFooter);
 
@@ -463,6 +465,31 @@ namespace Apache.Ignite.Core.Tests
         }
 
         /// <summary>
+        /// Tests the consistent id.
+        /// </summary>
+        [Test]
+        [NUnit.Framework.Category(TestUtils.CategoryIntensive)]
+        public void TestConsistentId()
+        {
+            var ids = new object[]
+            {
+                null, new MyConsistentId {Data = "foo"}, "str", 1, 1.1, DateTime.Now, Guid.NewGuid()
+            };
+
+            var cfg = TestUtils.GetTestConfiguration();
+
+            foreach (var id in ids)
+            {
+                cfg.ConsistentId = id;
+
+                using (var ignite = Ignition.Start(cfg))
+                {
+                    Assert.AreEqual(id, ignite.GetConfiguration().ConsistentId);
+                }
+            }
+        }
+
+        /// <summary>
         /// Tests the ip finders.
         /// </summary>
         /// <param name="ipFinder">The ip finder.</param>
@@ -636,7 +663,7 @@ namespace Apache.Ignite.Core.Tests
                     JoinTimeout = TimeSpan.FromSeconds(5),
                     IpFinder = new TcpDiscoveryStaticIpFinder
                     {
-                        Endpoints = new[] { "127.0.0.1:49900", "127.0.0.1:49901" }
+                        Endpoints = new[] {"127.0.0.1:49900", "127.0.0.1:49901"}
                     },
                     ClientReconnectDisabled = true,
                     ForceServerMode = true,
@@ -718,7 +745,7 @@ namespace Apache.Ignite.Core.Tests
                     }
                 },
                 // Skip cache check because with persistence the grid is not active by default.
-                PluginConfigurations = new[] { new TestIgnitePluginConfiguration{ SkipCacheCheck = true } },
+                PluginConfigurations = new[] {new TestIgnitePluginConfiguration {SkipCacheCheck = true}},
                 EventStorageSpi = new MemoryEventStorageSpi
                 {
                     ExpirationTimeout = TimeSpan.FromSeconds(5),
@@ -754,7 +781,7 @@ namespace Apache.Ignite.Core.Tests
                             EmptyPagesPoolSize = 66,
                             SwapFilePath = "somePath2",
                             MetricsEnabled = true
-                        } 
+                        }
                     }
                 },
                 PublicThreadPoolSize = 3,
@@ -798,8 +825,42 @@ namespace Apache.Ignite.Core.Tests
                     MetricsEnabled = true,
                     SubIntervals = 7,
                     RateTimeInterval = TimeSpan.FromSeconds(9)
-                }
+                },
+                ConsistentId = new MyConsistentId {Data = "abc"}
             };
         }
+
+        private class MyConsistentId
+        {
+            public string Data { get; set; }
+
+            private bool Equals(MyConsistentId other)
+            {
+                return string.Equals(Data, other.Data);
+            }
+
+            public override bool Equals(object obj)
+            {
+                if (ReferenceEquals(null, obj)) return false;
+                if (ReferenceEquals(this, obj)) return true;
+                if (obj.GetType() != GetType()) return false;
+                return Equals((MyConsistentId) obj);
+            }
+
+            public override int GetHashCode()
+            {
+                return (Data != null ? Data.GetHashCode() : 0);
+            }
+
+            public static bool operator ==(MyConsistentId left, MyConsistentId right)
+            {
+                return Equals(left, right);
+            }
+
+            public static bool operator !=(MyConsistentId left, MyConsistentId right)
+            {
+                return !Equals(left, right);
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/68c100df/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 14cd375..cb91ee1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -281,6 +281,7 @@ namespace Apache.Ignite.Core
             writer.WriteTimeSpanAsLongNullable(_clientFailureDetectionTimeout);
             writer.WriteTimeSpanAsLongNullable(_longQueryWarningTimeout);
             writer.WriteBooleanNullable(_isActiveOnStart);
+            writer.WriteObjectDetached(ConsistentId);
 
             // Thread pools
             writer.WriteIntNullable(_publicThreadPoolSize);
@@ -546,6 +547,7 @@ namespace Apache.Ignite.Core
             _clientFailureDetectionTimeout = r.ReadTimeSpanNullable();
             _longQueryWarningTimeout = r.ReadTimeSpanNullable();
             _isActiveOnStart = r.ReadBooleanNullable();
+            ConsistentId = r.ReadObject<object>();
 
             // Thread pools
             _publicThreadPoolSize = r.ReadIntNullable();
@@ -1272,5 +1274,10 @@ namespace Apache.Ignite.Core
             get { return _isActiveOnStart ?? DefaultIsActiveOnStart; }
             set { _isActiveOnStart = value; }
         }
+
+        /// <summary>
+        /// Gets or sets consistent globally unique node identifier which survives node restarts.
+        /// </summary>
+        public object ConsistentId { get; set; }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/68c100df/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index ac1111b..19ce110 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1484,6 +1484,11 @@
                         </xs:sequence>
                     </xs:complexType>
                 </xs:element>
+                <xs:element name="consistentId" minOccurs="0">
+                    <xs:annotation>
+                        <xs:documentation>Consistent globally unique node identifier which survives node restarts.</xs:documentation>
+                    </xs:annotation>
+                </xs:element>
             </xs:all>
             <xs:attribute name="igniteInstanceName" type="xs:string">
                 <xs:annotation>

http://git-wip-us.apache.org/repos/asf/ignite/blob/68c100df/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
index 775add4..8ee0c07 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
@@ -518,7 +518,9 @@ namespace Apache.Ignite.Core.Impl.Common
         {
             Debug.Assert(obj != null);
 
-            return obj.GetType().GetProperties().Where(p => !Equals(p.GetValue(obj, null), GetDefaultValue(p)));
+            return obj.GetType().GetProperties()
+                .Where(p => p.GetIndexParameters().Length == 0 &&  // Skip indexed properties.
+                            !Equals(p.GetValue(obj, null), GetDefaultValue(p)));
         }
 
         /// <summary>


[13/17] ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-3478

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

# Conflicts:
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java


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

Branch: refs/heads/ignite-3479
Commit: 9f0572bb6569332e037622cc4c31b1d8268f581f
Parents: 7a4baba aefa9a8
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 26 12:42:46 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 26 12:42:46 2017 +0300

----------------------------------------------------------------------
 modules/compatibility/README.txt                |   5 +
 modules/compatibility/licenses/apache-2.0.txt   | 202 ++++++++
 modules/compatibility/pom.xml                   |  94 ++++
 .../ignite/compatibility/package-info.java      |  22 +
 .../DummyPersistenceCompatibilityTest.java      | 108 ++++
 ...itePersistenceCompatibilityAbstractTest.java |  89 ++++
 .../compatibility/persistence/package-info.java |  22 +
 .../junits/CompatibilityTestsFacade.java        |  46 ++
 .../junits/IgniteCompatibilityAbstractTest.java | 280 +++++++++++
 .../junits/IgniteCompatibilityNodeRunner.java   | 157 ++++++
 .../logger/ListenedGridTestLog4jLogger.java     |  91 ++++
 .../junits/logger/package-info.java             |  22 +
 .../testframework/junits/package-info.java      |  22 +
 .../testframework/package-info.java             |  22 +
 .../plugins/DisabledValidationProcessor.java    |  42 ++
 .../TestCompatibilityPluginProvider.java        | 119 +++++
 .../testframework/plugins/package-info.java     |  22 +
 .../testframework/util/MavenUtils.java          | 208 ++++++++
 .../testframework/util/package-info.java        |  22 +
 .../IgniteCompatibilityBasicTestSuite.java      |  38 ++
 .../compatibility/testsuites/package-info.java  |  22 +
 .../org.apache.ignite.plugin.PluginProvider     |   1 +
 .../configuration/IgniteConfiguration.java      |   6 +
 .../cache/GatewayProtectedCacheProxy.java       |   5 -
 .../processors/cache/GridCacheAdapter.java      | 135 +++--
 .../processors/cache/GridCacheProxyImpl.java    |  12 -
 .../processors/cache/IgniteCacheProxy.java      |   8 -
 .../processors/cache/IgniteCacheProxyImpl.java  |  16 -
 .../processors/cache/IgniteInternalCache.java   |   9 -
 .../dht/CacheDistributedGetFutureAdapter.java   |   5 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |   5 -
 .../cache/distributed/dht/GridDhtGetFuture.java |   2 -
 .../distributed/dht/GridDhtGetSingleFuture.java |   6 +-
 .../dht/GridDhtPartitionTopologyImpl.java       | 495 ++++++++++---------
 .../dht/GridPartitionedGetFuture.java           |  22 +-
 .../dht/GridPartitionedSingleGetFuture.java     |   5 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  67 +--
 .../dht/colocated/GridDhtColocatedCache.java    |  24 +-
 .../distributed/near/GridNearAtomicCache.java   |   2 -
 .../distributed/near/GridNearCacheAdapter.java  |   3 -
 .../distributed/near/GridNearCacheEntry.java    |   1 -
 .../distributed/near/GridNearGetFuture.java     |   3 -
 .../near/GridNearTransactionalCache.java        |   3 -
 .../cache/distributed/near/GridNearTxLocal.java |   2 -
 .../local/atomic/GridLocalAtomicCache.java      |   2 -
 .../GridCacheDatabaseSharedManager.java         |  10 +-
 .../wal/FileWriteAheadLogManager.java           |   4 +-
 .../utils/PlatformConfigurationUtils.java       |  10 +
 .../processors/query/GridQueryProcessor.java    |   2 +-
 .../ignite/internal/util/IgniteUtils.java       |   9 +
 .../org.apache.ignite.plugin.PluginProvider     |   2 +-
 .../IgniteCacheTopologySafeGetSelfTest.java     | 222 ---------
 .../local/GridCacheLocalFullApiSelfTest.java    |  76 ++-
 .../IgnitePdsExchangeDuringCheckpointTest.java  | 135 +++++
 .../file/IgnitePdsThreadInterruptionTest.java   |   2 +-
 .../persistence/db/wal/IgnitePdsWalTlbTest.java |   4 +-
 .../junits/multijvm/IgniteNodeRunner.java       |   2 +-
 .../junits/multijvm/IgniteProcessProxy.java     |  90 +++-
 .../IgniteCacheDataStructuresSelfTestSuite.java |   4 +-
 .../IgniteCacheFailoverTestSuite.java           |   2 -
 .../ignite/testsuites/IgnitePdsTestSuite2.java  |   4 +
 .../cache/hibernate/HibernateCacheProxy.java    |   5 -
 .../TestExtensions.cs                           |   2 +
 .../Apache.Ignite.Core.Tests.csproj             |   4 +
 .../Binary/BinaryDynamicRegistrationTest.cs     |  15 +-
 .../Cache/CacheConfigurationTest.cs             |  39 +-
 .../Cache/PersistentStoreTest.cs                |  47 +-
 .../Config/Dynamic/dynamic-data.xml             |   2 +
 .../Config/cache-default.xml                    |  56 +++
 .../IgniteConfigurationSerializerTest.cs        |  65 +--
 .../IgniteConfigurationTest.cs                  |  73 ++-
 .../Apache.Ignite.Core.Tests/TestUtils.cs       |  61 +++
 .../Cache/Configuration/CacheConfiguration.cs   |  14 +-
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  10 +
 .../IgniteConfigurationSection.xsd              |   5 +
 .../Common/IgniteConfigurationXmlSerializer.cs  |   4 +-
 pom.xml                                         |   8 +
 77 files changed, 2616 insertions(+), 866 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 437d9d7,6d9f0d3..400f36a
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@@ -1812,9 -1803,7 +1804,8 @@@ public abstract class GridCacheAdapter<
              skipVals,
              /*keep cache objects*/false,
              recovery,
-             canRemap,
 -            needVer);
 +            needVer,
 +            null); // TODO IGNITE-3478.
      }
  
      /**
@@@ -1844,9 -1832,7 +1834,8 @@@
          final boolean skipVals,
          final boolean keepCacheObjects,
          final boolean recovery,
-         boolean canRemap,
 -        final boolean needVer
 +        final boolean needVer,
 +        MvccCoordinatorVersion mvccVer
      ) {
          if (F.isEmpty(keys))
              return new GridFinishedFuture<>(Collections.<K1, V1>emptyMap());

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index ac04e4b,bbb2c5b..ee42a14
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@@ -777,9 -771,7 +774,8 @@@ public abstract class GridDhtCacheAdapt
          String taskName,
          @Nullable IgniteCacheExpiryPolicy expiry,
          boolean skipVals,
-         boolean canRemap,
 -        boolean recovery
 +        boolean recovery,
 +        MvccCoordinatorVersion mvccVer
      ) {
          return getAllAsync0(keys,
              readerArgs,
@@@ -792,9 -784,7 +788,8 @@@
              skipVals,
              /*keep cache objects*/true,
              recovery,
-             canRemap,
 -            /*need version*/true);
 +            /*need version*/true,
 +            mvccVer);
      }
  
      /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index 78a4057,4319374..0b1d76d
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@@ -428,9 -422,7 +428,8 @@@ public final class GridDhtGetFuture<K, 
                  taskName,
                  expiryPlc,
                  skipVals,
-                 /*can remap*/true,
 -                recovery);
 +                recovery,
 +                mvccVer);
          }
          else {
              final ReaderArguments args = readerArgs;
@@@ -453,9 -445,7 +452,8 @@@
                              taskName,
                              expiryPlc,
                              skipVals,
-                             /*can remap*/true,
 -                            recovery);
 +                            recovery,
 +                            mvccVer);
                      }
                  }
              );

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
index 67e726e,7c6c020..9fb4b0a
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
@@@ -365,9 -365,7 +365,8 @@@ public final class GridDhtGetSingleFutu
                  taskName,
                  expiryPlc,
                  skipVals,
-                 /*can remap*/true,
 -                recovery);
 +                recovery,
-                 null); // TODO IGNITE-3478
++                null);  // TODO IGNITE-3478
          }
          else {
              final ReaderArguments args = readerArgs;
@@@ -392,9 -390,7 +391,8 @@@
                                  taskName,
                                  expiryPlc,
                                  skipVals,
-                                 /*can remap*/true,
 -                                recovery);
 +                                recovery,
-                                 null); // TODO IGNITE-3478
++                                null);  // TODO IGNITE-3478
  
                          fut0.listen(createGetFutureListener());
                      }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 9b7d733,73c0ea5..cd8b8c8
--- 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
@@@ -75,15 -73,6 +75,12 @@@ public class GridPartitionedGetFuture<K
      /** Logger. */
      private static IgniteLogger log;
  
-     /** Topology version. */
-     private AffinityTopologyVersion topVer;
- 
 +    /** */
 +    private ClusterNode mvccCrd;
 +
 +    /** */
 +    private MvccCoordinatorVersion mvccVer;
 +
      /**
       * @param cctx Context.
       * @param keys Keys.
@@@ -143,49 -128,17 +136,49 @@@
          AffinityTopologyVersion lockedTopVer = cctx.shared().lockedTopologyVersion(null);
  
          if (lockedTopVer != null) {
 -            canRemap = false;
 +            topVer = lockedTopVer;
  
 -            map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), lockedTopVer);
 +            canRemap = false;
          }
          else {
-             topVer = this.topVer.topologyVersion() > 0 ? this.topVer :
+             topVer = topVer.topologyVersion() > 0 ? topVer :
                  canRemap ? cctx.affinity().affinityTopologyVersion() : cctx.shared().exchange().readyAffinityVersion();
 +        }
 +
 +        // TODO IGNITE-3478 (correct failover and remap).
 +        if (cctx.mvccEnabled()) {
 +            mvccCrd = cctx.shared().coordinators().coordinator(topVer);
 +
 +            if (mvccCrd == null) {
 +                onDone(new ClusterTopologyCheckedException("Mvcc coordinator is not assigned: " + topVer));
 +
 +                return;
 +            }
 +
 +            IgniteInternalFuture<MvccCoordinatorVersion> cntrFut = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
  
 -            map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer);
 +            cntrFut.listen(new IgniteInClosure<IgniteInternalFuture<MvccCoordinatorVersion>>() {
 +                @Override public void apply(IgniteInternalFuture<MvccCoordinatorVersion> fut) {
 +                    try {
 +                        mvccVer = fut.get();
 +
 +                        map(keys,
 +                            Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(),
 +                            GridPartitionedGetFuture.this.topVer);
 +
 +                        markInitialized();
 +                    }
 +                    catch (IgniteCheckedException e) {
 +                        onDone(e);
 +                    }
 +                }
 +            });
 +
 +            return;
          }
  
 +        map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer);
 +
          markInitialized();
      }
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0572bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------


[11/17] ignite git commit: IGNITE-6494 .NET: Fix CacheConfiguration.WriteSynchronizationMode default value

Posted by sb...@apache.org.
IGNITE-6494 .NET: Fix CacheConfiguration.WriteSynchronizationMode default value

This closes #2741


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

Branch: refs/heads/ignite-3479
Commit: 357f6035a917ad7be9b7002aea5638d9d61b5330
Parents: 737033c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Sep 26 11:37:31 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Sep 26 11:37:31 2017 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests.csproj             |  4 ++
 .../Binary/BinaryDynamicRegistrationTest.cs     | 15 +++--
 .../Cache/CacheConfigurationTest.cs             | 39 ++++++++++++-
 .../Config/Dynamic/dynamic-data.xml             |  2 +
 .../Config/cache-default.xml                    | 56 ++++++++++++++++++
 .../IgniteConfigurationSerializerTest.cs        | 58 ++-----------------
 .../Apache.Ignite.Core.Tests/TestUtils.cs       | 61 ++++++++++++++++++++
 .../Cache/Configuration/CacheConfiguration.cs   | 14 ++++-
 8 files changed, 187 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/357f6035/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 9e6cfb2..375b6b8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -308,6 +308,10 @@
     <Content Include="Config\cache-binarizables.xml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="Config\cache-default.xml">
+      <SubType>Designer</SubType>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="Config\cache-local-node.xml">
       <SubType>Designer</SubType>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

http://git-wip-us.apache.org/repos/asf/ignite/blob/357f6035/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
index 01804b7..e635bd1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
@@ -113,7 +113,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                     {
                         CacheStoreFactory = new StoreFactory(),
                         ReadThrough = true,
-                        WriteThrough = true
+                        WriteThrough = true,
+                        KeepBinaryInStore = true
                     }
                 }
             };
@@ -125,7 +126,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                 {
                     CacheStoreFactory = new StoreFactory(),
                     ReadThrough = true,
-                    WriteThrough = true
+                    WriteThrough = true,
+                    KeepBinaryInStore = true
                 });
                 dynCache[2] = new Foo { Str = "test2", Int = 3 };
 
@@ -203,7 +205,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                     {
                         CacheStoreFactory = new StoreFactory {StringProp = "test", IntProp = 9},
                         ReadThrough = true,
-                        WriteThrough = true
+                        WriteThrough = true,
+                        KeepBinaryInStore = true
                     }
                 }
             };
@@ -410,7 +413,11 @@ namespace Apache.Ignite.Core.Tests.Binary
         /// </summary>
         private static void Test(IIgnite ignite1, IIgnite ignite2)
         {
-            var cfg = new CacheConfiguration("cache") {CacheMode = CacheMode.Partitioned};
+            var cfg = new CacheConfiguration("cache")
+            {
+                CacheMode = CacheMode.Partitioned,
+                WriteSynchronizationMode = CacheWriteSynchronizationMode.FullSync
+            };
 
             // Put on one grid.
             var cache1 = ignite1.GetOrCreateCache<int, object>(cfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/357f6035/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index 435e65f..b400ef6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -49,6 +49,9 @@ namespace Apache.Ignite.Core.Tests.Cache
         private const string CacheName2 = "cacheName2";
 
         /** */
+        private const string SpringCacheName = "cache-default-spring";
+
+        /** */
         private static int _factoryProp;
 
 
@@ -79,7 +82,8 @@ namespace Apache.Ignite.Core.Tests.Cache
                             MaxSize = 99 * 1024 * 1024
                         }
                     }
-                }
+                },
+                SpringConfigUrl = "Config\\cache-default.xml"
             };
 
             _ignite = Ignition.Start(cfg);
@@ -104,7 +108,24 @@ namespace Apache.Ignite.Core.Tests.Cache
 
             AssertConfigIsDefault(_ignite.GetCache<int, int>(DefaultCacheName).GetConfiguration());
 
-            AssertConfigIsDefault(_ignite.GetConfiguration().CacheConfiguration.Single(c => c.Name == DefaultCacheName));
+            AssertConfigIsDefault(_ignite.GetConfiguration().CacheConfiguration
+                .Single(c => c.Name == DefaultCacheName));
+        }
+
+        /// <summary>
+        /// Tests that defaults are the same in Java.
+        /// </summary>
+        [Test]
+        public void TestDefaultsAreSameInJava()
+        {
+            var springConfig = _ignite.GetCache<int, int>(SpringCacheName).GetConfiguration();
+
+            var ignoredProps = new[] {"AffinityFunction"};
+
+            TestUtils.AssertReflectionEqual(springConfig, new CacheConfiguration(SpringCacheName),
+                ignoredProperties: new HashSet<string>(ignoredProps));
+            
+            AssertConfigIsDefault(springConfig);
         }
 
         /// <summary>
@@ -221,7 +242,7 @@ namespace Apache.Ignite.Core.Tests.Cache
             Assert.AreEqual(CacheConfiguration.DefaultCopyOnRead, cfg.CopyOnRead);
             Assert.AreEqual(CacheConfiguration.DefaultEagerTtl, cfg.EagerTtl);
             Assert.AreEqual(CacheConfiguration.DefaultInvalidate, cfg.Invalidate);
-            Assert.AreEqual(CacheConfiguration.DefaultKeepVinaryInStore, cfg.KeepBinaryInStore);
+            Assert.AreEqual(CacheConfiguration.DefaultKeepBinaryInStore, cfg.KeepBinaryInStore);
             Assert.AreEqual(CacheConfiguration.DefaultLoadPreviousValue, cfg.LoadPreviousValue);
             Assert.AreEqual(CacheConfiguration.DefaultLockTimeout, cfg.LockTimeout);
 #pragma warning disable 618
@@ -240,6 +261,12 @@ namespace Apache.Ignite.Core.Tests.Cache
             Assert.AreEqual(CacheConfiguration.DefaultWriteBehindFlushThreadCount, cfg.WriteBehindFlushThreadCount);
             Assert.AreEqual(CacheConfiguration.DefaultWriteBehindCoalescing, cfg.WriteBehindCoalescing);
             Assert.AreEqual(CacheConfiguration.DefaultPartitionLossPolicy, cfg.PartitionLossPolicy);
+            Assert.AreEqual(CacheConfiguration.DefaultWriteSynchronizationMode, cfg.WriteSynchronizationMode);
+            Assert.AreEqual(CacheConfiguration.DefaultWriteBehindCoalescing, cfg.WriteBehindCoalescing);
+            Assert.AreEqual(CacheConfiguration.DefaultWriteThrough, cfg.WriteThrough);
+            Assert.AreEqual(CacheConfiguration.DefaultReadThrough, cfg.ReadThrough);
+            Assert.AreEqual(CacheConfiguration.DefaultCopyOnRead, cfg.CopyOnRead);
+            Assert.AreEqual(CacheConfiguration.DefaultKeepBinaryInStore, cfg.KeepBinaryInStore);
         }
 
         /// <summary>
@@ -272,13 +299,19 @@ namespace Apache.Ignite.Core.Tests.Cache
             Assert.AreEqual(x.EnableStatistics, y.EnableStatistics);
             Assert.AreEqual(x.MemoryPolicyName, y.MemoryPolicyName);
             Assert.AreEqual(x.PartitionLossPolicy, y.PartitionLossPolicy);
+            Assert.AreEqual(x.WriteBehindCoalescing, y.WriteBehindCoalescing);
             Assert.AreEqual(x.GroupName, y.GroupName);
+            Assert.AreEqual(x.WriteSynchronizationMode, y.WriteSynchronizationMode);
 
             if (x.ExpiryPolicyFactory != null)
+            {
                 Assert.AreEqual(x.ExpiryPolicyFactory.CreateInstance().GetType(),
                     y.ExpiryPolicyFactory.CreateInstance().GetType());
+            }
             else
+            {
                 Assert.IsNull(y.ExpiryPolicyFactory);
+            }
 
             AssertConfigsAreEqual(x.QueryEntities, y.QueryEntities);
             AssertConfigsAreEqual(x.NearConfiguration, y.NearConfiguration);

http://git-wip-us.apache.org/repos/asf/ignite/blob/357f6035/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml
index 682a517..3b37fa9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml
@@ -35,12 +35,14 @@
                     <property name="name" value="p"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="atomicityMode" value="TRANSACTIONAL"/>
+                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
                 </bean>
 
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
                     <property name="name" value="pa"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
                 </bean>
             </list>
         </property>

http://git-wip-us.apache.org/repos/asf/ignite/blob/357f6035/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-default.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-default.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-default.xml
new file mode 100644
index 0000000..7832e87
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-default.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="localHost" value="127.0.0.1"/>
+        <property name="connectorConfiguration"><null/></property>
+
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="cache-default-spring"/>
+                </bean>
+            </list>
+        </property>
+
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host IP address. -->
+                                <value>127.0.0.1:47500</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+                <property name="socketTimeout" value="300" />
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/357f6035/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 23ee884..2177c6a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -20,7 +20,6 @@
 namespace Apache.Ignite.Core.Tests
 {
     using System;
-    using System.Collections;
     using System.Collections.Generic;
     using System.Configuration;
     using System.Diagnostics.CodeAnalysis;
@@ -514,15 +513,15 @@ namespace Apache.Ignite.Core.Tests
         {
             // Empty section.
             var cfg = IgniteConfiguration.FromXml("<x />");
-            AssertReflectionEqual(new IgniteConfiguration(), cfg);
+            TestUtils.AssertReflectionEqual(new IgniteConfiguration(), cfg);
 
             // Empty section with XML header.
             cfg = IgniteConfiguration.FromXml("<?xml version=\"1.0\" encoding=\"utf-16\"?><x />");
-            AssertReflectionEqual(new IgniteConfiguration(), cfg);
+            TestUtils.AssertReflectionEqual(new IgniteConfiguration(), cfg);
 
             // Simple test.
             cfg = IgniteConfiguration.FromXml(@"<igCfg igniteInstanceName=""myGrid"" clientMode=""true"" />");
-            AssertReflectionEqual(new IgniteConfiguration {IgniteInstanceName = "myGrid", ClientMode = true}, cfg);
+            TestUtils.AssertReflectionEqual(new IgniteConfiguration {IgniteInstanceName = "myGrid", ClientMode = true}, cfg);
 
             // Invalid xml.
             var ex = Assert.Throws<ConfigurationErrorsException>(() =>
@@ -537,7 +536,7 @@ namespace Apache.Ignite.Core.Tests
             {
                 cfg = IgniteConfiguration.FromXml(xmlReader);
             }
-            AssertReflectionEqual(new IgniteConfiguration { IgniteInstanceName = "myGrid", ClientMode = true }, cfg);
+            TestUtils.AssertReflectionEqual(new IgniteConfiguration { IgniteInstanceName = "myGrid", ClientMode = true }, cfg);
         }
 
         /// <summary>
@@ -589,7 +588,7 @@ namespace Apache.Ignite.Core.Tests
         {
             var resCfg = SerializeDeserialize(cfg);
 
-            AssertReflectionEqual(cfg, resCfg);
+            TestUtils.AssertReflectionEqual(cfg, resCfg);
         }
 
         /// <summary>
@@ -602,53 +601,6 @@ namespace Apache.Ignite.Core.Tests
             return IgniteConfiguration.FromXml(xml);
         }
 
-        /// <summary>
-        /// Asserts equality with reflection.
-        /// </summary>
-        private static void AssertReflectionEqual(object x, object y)
-        {
-            var type = x.GetType();
-
-            Assert.AreEqual(type, y.GetType());
-
-            if (type.IsValueType || type == typeof (string) || type.IsSubclassOf(typeof (Type)))
-            {
-                Assert.AreEqual(x, y);
-                return;
-            }
-
-            var props = type.GetProperties().Where(p => p.GetIndexParameters().Length == 0);
-
-            foreach (var propInfo in props)
-            {
-                var propType = propInfo.PropertyType;
-
-                var xVal = propInfo.GetValue(x, null);
-                var yVal = propInfo.GetValue(y, null);
-
-                if (xVal == null || yVal == null)
-                {
-                    Assert.IsNull(xVal);
-                    Assert.IsNull(yVal);
-                }
-                else if (propType != typeof(string) && propType.IsGenericType &&
-                         (propType.GetGenericTypeDefinition() == typeof(ICollection<>) ||
-                          propType.GetGenericTypeDefinition() == typeof(IDictionary<,>) ))
-                {
-                    var xCol = ((IEnumerable) xVal).OfType<object>().ToList();
-                    var yCol = ((IEnumerable) yVal).OfType<object>().ToList();
-
-                    Assert.AreEqual(xCol.Count, yCol.Count);
-
-                    for (int i = 0; i < xCol.Count; i++)
-                        AssertReflectionEqual(xCol[i], yCol[i]);
-                }
-                else
-                {
-                    AssertReflectionEqual(xVal, yVal);
-                }
-            }
-        }
 
         /// <summary>
         /// Gets the test configuration.

http://git-wip-us.apache.org/repos/asf/ignite/blob/357f6035/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index 4b171b0..34e356b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -18,6 +18,7 @@
 namespace Apache.Ignite.Core.Tests
 {
     using System;
+    using System.Collections;
     using System.Collections.Concurrent;
     using System.Collections.Generic;
     using System.Diagnostics;
@@ -402,5 +403,65 @@ namespace Apache.Ignite.Core.Tests
         {
             return GetPrimaryKeys(ignite, cacheName, node).First();
         }
+
+        /// <summary>
+        /// Asserts equality with reflection.
+        /// </summary>
+        public static void AssertReflectionEqual(object x, object y, string propertyPath = null,
+            HashSet<string> ignoredProperties = null)
+        {
+            var type = x.GetType();
+
+            Assert.AreEqual(type, y.GetType());
+
+            propertyPath = propertyPath ?? type.Name;
+
+            if (type.IsValueType || type == typeof(string) || type.IsSubclassOf(typeof(Type)))
+            {
+                Assert.AreEqual(x, y, propertyPath);
+                return;
+            }
+
+            var props = type.GetProperties().Where(p => p.GetIndexParameters().Length == 0);
+
+            foreach (var propInfo in props)
+            {
+                var propType = propInfo.PropertyType;
+
+                if (ignoredProperties != null && ignoredProperties.Contains(propInfo.Name))
+                {
+                    continue;
+                }
+
+                var propName = propertyPath + "." + propInfo.Name;
+
+                var xVal = propInfo.GetValue(x, null);
+                var yVal = propInfo.GetValue(y, null);
+
+                if (xVal == null || yVal == null)
+                {
+                    Assert.IsNull(xVal, propName);
+                    Assert.IsNull(yVal, propName);
+                }
+                else if (propType != typeof(string) && propType.IsGenericType &&
+                         (propType.GetGenericTypeDefinition() == typeof(ICollection<>) ||
+                          propType.GetGenericTypeDefinition() == typeof(IDictionary<,>)))
+                {
+                    var xCol = ((IEnumerable)xVal).OfType<object>().ToList();
+                    var yCol = ((IEnumerable)yVal).OfType<object>().ToList();
+
+                    Assert.AreEqual(xCol.Count, yCol.Count, propName);
+
+                    for (var i = 0; i < xCol.Count; i++)
+                    {
+                        AssertReflectionEqual(xCol[i], yCol[i], propName, ignoredProperties);
+                    }
+                }
+                else
+                {
+                    AssertReflectionEqual(xVal, yVal, propName, ignoredProperties);
+                }
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/357f6035/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index d08a191..421f16f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -81,6 +81,10 @@ namespace Apache.Ignite.Core.Cache.Configuration
         /// <summary> Default rebalance batch size in bytes. </summary>
         public const int DefaultRebalanceBatchSize = 512*1024; // 512K
 
+        /// <summary> Default value for <see cref="WriteSynchronizationMode"/> property.</summary>
+        public const CacheWriteSynchronizationMode DefaultWriteSynchronizationMode = 
+            CacheWriteSynchronizationMode.PrimarySync;
+
         /// <summary> Default value for eager ttl flag. </summary>
         public const bool DefaultEagerTtl = true;
 
@@ -112,8 +116,12 @@ namespace Apache.Ignite.Core.Cache.Configuration
         public static readonly TimeSpan DefaultLongQueryWarningTimeout = TimeSpan.FromMilliseconds(3000);
 
         /// <summary> Default value for keep portable in store behavior .</summary>
+        [Obsolete("Use DefaultKeepBinaryInStore instead.")]
         public const bool DefaultKeepVinaryInStore = true;
 
+        /// <summary> Default value for <see cref="KeepBinaryInStore"/> property.</summary>
+        public const bool DefaultKeepBinaryInStore = false;
+
         /// <summary> Default value for 'copyOnRead' flag. </summary>
         public const bool DefaultCopyOnRead = true;
 
@@ -154,9 +162,10 @@ namespace Apache.Ignite.Core.Cache.Configuration
             AtomicityMode = DefaultAtomicityMode;
             CacheMode = DefaultCacheMode;
             CopyOnRead = DefaultCopyOnRead;
+            WriteSynchronizationMode = DefaultWriteSynchronizationMode;
             EagerTtl = DefaultEagerTtl;
             Invalidate = DefaultInvalidate;
-            KeepBinaryInStore = DefaultKeepVinaryInStore;
+            KeepBinaryInStore = DefaultKeepBinaryInStore;
             LoadPreviousValue = DefaultLoadPreviousValue;
             LockTimeout = DefaultLockTimeout;
 #pragma warning disable 618
@@ -438,6 +447,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
         /// Gets or sets write synchronization mode. This mode controls whether the main        
         /// caller should wait for update on other nodes to complete or not.
         /// </summary>
+        [DefaultValue(DefaultWriteSynchronizationMode)]
         public CacheWriteSynchronizationMode WriteSynchronizationMode { get; set; }
 
         /// <summary>
@@ -467,7 +477,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
         /// Gets or sets the flag indicating whether <see cref="ICacheStore"/> is working with binary objects 
         /// instead of deserialized objects.
         /// </summary>
-        [DefaultValue(DefaultKeepVinaryInStore)]
+        [DefaultValue(DefaultKeepBinaryInStore)]
         public bool KeepBinaryInStore { get; set; }
 
         /// <summary>


[10/17] ignite git commit: .NET: Fix code coverage - exclude remote-only class

Posted by sb...@apache.org.
.NET: Fix code coverage - exclude remote-only class


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

Branch: refs/heads/ignite-3479
Commit: 737033ca69d94c0b7fbc5554e06a461489fa54ea
Parents: 21cc7a4
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 25 19:09:29 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 25 19:09:29 2017 +0300

----------------------------------------------------------------------
 .../dotnet/Apache.Ignite.Core.Tests.TestDll/TestExtensions.cs      | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/737033ca/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/TestExtensions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/TestExtensions.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/TestExtensions.cs
index 65a1484..f67295b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/TestExtensions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/TestExtensions.cs
@@ -17,11 +17,13 @@
 
 namespace Apache.Ignite.Core.Tests.TestDll
 {
+    using System.Diagnostics.CodeAnalysis;
     using System.Linq;
 
     /// <summary>
     /// Extension methods for tests.
     /// </summary>
+    [ExcludeFromCodeCoverage]
     public static class TestExtensions
     {
         /// <summary>


[05/17] ignite git commit: IGNITE-6488 Added info message for index rebuild

Posted by sb...@apache.org.
IGNITE-6488 Added info message for index rebuild


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

Branch: refs/heads/ignite-3479
Commit: 7ecdd7dcf8e8c7334f3003bbf47d9318a0b2afab
Parents: 54a00fc
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Sep 22 18:15:26 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Sep 22 18:15:26 2017 +0300

----------------------------------------------------------------------
 .../cache/persistence/GridCacheDatabaseSharedManager.java       | 5 ++++-
 .../ignite/internal/processors/query/GridQueryProcessor.java    | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7ecdd7dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 426e27f..9f1ccb4 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -860,7 +860,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             restoreState();
 
         if (cctx.kernalContext().query().moduleEnabled()) {
-            for (GridCacheContext cacheCtx : (Collection<GridCacheContext>)cctx.cacheContexts()) {
+            for (final GridCacheContext cacheCtx : (Collection<GridCacheContext>)cctx.cacheContexts()) {
                 if (cacheCtx.startTopologyVersion().equals(fut.initialVersion()) &&
                     !cctx.pageStore().hasIndexStore(cacheCtx.groupId()) && cacheCtx.affinityNode()) {
                     final int cacheId = cacheCtx.cacheId();
@@ -873,6 +873,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                     rebuildFut.listen(new CI1<IgniteInternalFuture>() {
                         @Override public void apply(IgniteInternalFuture igniteInternalFut) {
                             idxRebuildFuts.remove(cacheId, rebuildFut);
+
+                            log().info("Finished indexes rebuilding for cache: [name=" + cacheCtx.config().getName()
+                                    + ", grpName=" + cacheCtx.config().getGroupName());
                         }
                     });
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ecdd7dc/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 51d3411..2a13b25 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1627,7 +1627,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @param desc Type descriptor.
      * @return Future that will be completed when rebuilding of all indexes is finished.
      */
-private IgniteInternalFuture<Object> rebuildIndexesFromHash(@Nullable final String cacheName,
+    private IgniteInternalFuture<Object> rebuildIndexesFromHash(@Nullable final String cacheName,
         @Nullable final QueryTypeDescriptorImpl desc) {
         if (idx == null)
             return new GridFinishedFuture<>(new IgniteCheckedException("Indexing is disabled."));


[03/17] ignite git commit: IGNITE-6434 Fixed error in checkpointer during topology change. Fixes #2718

Posted by sb...@apache.org.
IGNITE-6434 Fixed error in checkpointer during topology change. Fixes #2718


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

Branch: refs/heads/ignite-3479
Commit: c219d9b1de051811d79f07c4a954a1b80f8b92e1
Parents: c657144
Author: Eduard Shangareev <ed...@gmail.com>
Authored: Fri Sep 22 16:17:42 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Sep 22 16:17:42 2017 +0300

----------------------------------------------------------------------
 .../dht/GridDhtPartitionTopologyImpl.java       | 495 ++++++++++---------
 .../GridCacheDatabaseSharedManager.java         |   5 +-
 .../IgnitePdsExchangeDuringCheckpointTest.java  | 135 +++++
 .../IgniteCacheDataStructuresSelfTestSuite.java |   4 +-
 .../ignite/testsuites/IgnitePdsTestSuite2.java  |   4 +
 5 files changed, 407 insertions(+), 236 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c219d9b1/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 0f96b5b..380066a 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
@@ -298,20 +298,27 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
         GridDhtPartitionsExchangeFuture exchFut)
         throws IgniteInterruptedCheckedException
     {
-        U.writeLock(lock);
+        ctx.database().checkpointReadLock();
 
         try {
-            if (stopping)
-                return;
+            U.writeLock(lock);
 
-            long updateSeq = this.updateSeq.incrementAndGet();
+            try {
+                if (stopping)
+                    return;
 
-            initPartitions0(affVer, exchFut, updateSeq);
+                long updateSeq = this.updateSeq.incrementAndGet();
 
-            consistencyCheck();
+                initPartitions0(affVer, exchFut, updateSeq);
+
+                consistencyCheck();
+            }
+            finally {
+                lock.writeLock().unlock();
+            }
         }
         finally {
-            lock.writeLock().unlock();
+            ctx.database().checkpointReadUnlock();
         }
     }
 
@@ -589,101 +596,109 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
             ", affVer=" + grp.affinity().lastVersion() +
             ", fut=" + exchFut + ']';
 
-        lock.writeLock().lock();
+        ctx.database().checkpointReadLock();
 
         try {
-            if (stopping)
-                return false;
 
-            assert readyTopVer.initialized() : readyTopVer;
-            assert lastTopChangeVer.equals(readyTopVer);
+            lock.writeLock().lock();
 
-            if (log.isDebugEnabled())
-                log.debug("Partition map before afterExchange [exchId=" + exchFut.exchangeId() + ", fullMap=" +
-                    fullMapString() + ']');
+            try {
+                if (stopping)
+                    return false;
 
-            long updateSeq = this.updateSeq.incrementAndGet();
+                assert readyTopVer.initialized() : readyTopVer;
+                assert lastTopChangeVer.equals(readyTopVer);
 
-            for (int p = 0; p < num; p++) {
-                GridDhtLocalPartition locPart = localPartition0(p, topVer, false, false, false);
+                if (log.isDebugEnabled())
+                    log.debug("Partition map before afterExchange [exchId=" + exchFut.exchangeId() + ", fullMap=" +
+                        fullMapString() + ']');
 
-                if (partitionLocalNode(p, topVer)) {
-                    // This partition will be created during next topology event,
-                    // which obviously has not happened at this point.
-                    if (locPart == null) {
-                        if (log.isDebugEnabled())
-                            log.debug("Skipping local partition afterExchange (will not create): " + p);
+                long updateSeq = this.updateSeq.incrementAndGet();
 
-                        continue;
-                    }
+                for (int p = 0; p < num; p++) {
+                    GridDhtLocalPartition locPart = localPartition0(p, topVer, false, false, false);
 
-                    GridDhtPartitionState state = locPart.state();
+                    if (partitionLocalNode(p, topVer)) {
+                        // This partition will be created during next topology event,
+                        // which obviously has not happened at this point.
+                        if (locPart == null) {
+                            if (log.isDebugEnabled())
+                                log.debug("Skipping local partition afterExchange (will not create): " + p);
 
-                    if (state == MOVING) {
-                        if (grp.rebalanceEnabled()) {
-                            Collection<ClusterNode> owners = owners(p);
+                            continue;
+                        }
 
-                            // If there are no other owners, then become an owner.
-                            if (F.isEmpty(owners)) {
-                                boolean owned = locPart.own();
+                        GridDhtPartitionState state = locPart.state();
 
-                                assert owned : "Failed to own partition [grp=" + grp.cacheOrGroupName() + ", locPart=" +
-                                    locPart + ']';
+                        if (state == MOVING) {
+                            if (grp.rebalanceEnabled()) {
+                                Collection<ClusterNode> owners = owners(p);
 
-                                updateSeq = updateLocal(p, locPart.state(), updateSeq, topVer);
+                                // If there are no other owners, then become an owner.
+                                if (F.isEmpty(owners)) {
+                                    boolean owned = locPart.own();
 
-                                changed = true;
+                                    assert owned : "Failed to own partition [grp=" + grp.cacheOrGroupName() + ", locPart=" +
+                                        locPart + ']';
 
-                                if (grp.eventRecordable(EVT_CACHE_REBALANCE_PART_DATA_LOST)) {
-                                    DiscoveryEvent discoEvt = exchFut.events().lastEvent();
+                                    updateSeq = updateLocal(p, locPart.state(), updateSeq, topVer);
 
-                                    grp.addRebalanceEvent(p,
-                                        EVT_CACHE_REBALANCE_PART_DATA_LOST,
-                                        discoEvt.eventNode(),
-                                        discoEvt.type(),
-                                        discoEvt.timestamp());
-                                }
+                                    changed = true;
 
-                                if (log.isDebugEnabled())
-                                    log.debug("Owned partition: " + locPart);
+                                    if (grp.eventRecordable(EVT_CACHE_REBALANCE_PART_DATA_LOST)) {
+                                        DiscoveryEvent discoEvt = exchFut.events().lastEvent();
+
+                                        grp.addRebalanceEvent(p,
+                                            EVT_CACHE_REBALANCE_PART_DATA_LOST,
+                                            discoEvt.eventNode(),
+                                            discoEvt.type(),
+                                            discoEvt.timestamp());
+                                    }
+
+                                    if (log.isDebugEnabled())
+                                        log.debug("Owned partition: " + locPart);
+                                }
+                                else if (log.isDebugEnabled())
+                                    log.debug("Will not own partition (there are owners to rebalance from) [locPart=" +
+                                        locPart + ", owners = " + owners + ']');
                             }
-                            else if (log.isDebugEnabled())
-                                log.debug("Will not own partition (there are owners to rebalance from) [locPart=" +
-                                    locPart + ", owners = " + owners + ']');
+                            else
+                                updateSeq = updateLocal(p, locPart.state(), updateSeq, topVer);
                         }
-                        else
-                            updateSeq = updateLocal(p, locPart.state(), updateSeq, topVer);
                     }
-                }
-                else {
-                    if (locPart != null) {
-                        GridDhtPartitionState state = locPart.state();
+                    else {
+                        if (locPart != null) {
+                            GridDhtPartitionState state = locPart.state();
 
-                        if (state == MOVING) {
-                            locPart.rent(false);
+                            if (state == MOVING) {
+                                locPart.rent(false);
 
-                            updateSeq = updateLocal(p, locPart.state(), updateSeq, topVer);
+                                updateSeq = updateLocal(p, locPart.state(), updateSeq, topVer);
 
-                            changed = true;
+                                changed = true;
 
-                            if (log.isDebugEnabled())
-                                log.debug("Evicting moving partition (it does not belong to affinity): " + locPart);
+                                if (log.isDebugEnabled())
+                                    log.debug("Evicting moving partition (it does not belong to affinity): " + locPart);
+                            }
                         }
                     }
                 }
-            }
 
-            AffinityAssignment aff = grp.affinity().readyAffinity(topVer);
+                AffinityAssignment aff = grp.affinity().readyAffinity(topVer);
 
-            if (node2part != null && node2part.valid())
-                changed |= checkEvictions(updateSeq, aff);
+                if (node2part != null && node2part.valid())
+                    changed |= checkEvictions(updateSeq, aff);
 
-            updateRebalanceVersion(aff.assignment());
+                updateRebalanceVersion(aff.assignment());
 
-            consistencyCheck();
+                consistencyCheck();
+            }
+            finally {
+                lock.writeLock().unlock();
+            }
         }
         finally {
-            lock.writeLock().unlock();
+            ctx.database().checkpointReadUnlock();
         }
 
         return changed;
@@ -709,6 +724,8 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
     private GridDhtLocalPartition createPartition(int p) {
         assert lock.isWriteLockedByCurrentThread();
 
+        assert ctx.database().checkpointLockIsHeldByThread();
+
         GridDhtLocalPartition loc = locParts.get(p);
 
         if (loc == null || loc.state() == EVICTED) {
@@ -1183,232 +1200,239 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
 
         assert partMap != null;
 
-        lock.writeLock().lock();
+        ctx.database().checkpointReadLock();
 
         try {
-            if (stopping || !lastTopChangeVer.initialized() ||
-                // Ignore message not-related to exchange if exchange is in progress.
-                (exchangeVer == null && !lastTopChangeVer.equals(readyTopVer)))
-                return false;
+            lock.writeLock().lock();
 
-            if (incomeCntrMap != null) {
-                // update local counters in partitions
-                for (int i = 0; i < locParts.length(); i++) {
-                    GridDhtLocalPartition part = locParts.get(i);
+            try {
+                if (stopping || !lastTopChangeVer.initialized() ||
+                    // Ignore message not-related to exchange if exchange is in progress.
+                    (exchangeVer == null && !lastTopChangeVer.equals(readyTopVer)))
+                    return false;
 
-                    if (part == null)
-                        continue;
+                if (incomeCntrMap != null) {
+                    // update local counters in partitions
+                    for (int i = 0; i < locParts.length(); i++) {
+                        GridDhtLocalPartition part = locParts.get(i);
+
+                        if (part == null)
+                            continue;
 
-                    if (part.state() == OWNING || part.state() == MOVING) {
-                        long updCntr = incomeCntrMap.updateCounter(part.id());
+                        if (part.state() == OWNING || part.state() == MOVING) {
+                            long updCntr = incomeCntrMap.updateCounter(part.id());
 
-                        if (updCntr != 0 && updCntr > part.updateCounter())
-                            part.updateCounter(updCntr);
+                            if (updCntr != 0 && updCntr > part.updateCounter())
+                                part.updateCounter(updCntr);
+                        }
                     }
                 }
-            }
 
-            if (exchangeVer != null) {
-                // Ignore if exchange already finished or new exchange started.
-                if (readyTopVer.compareTo(exchangeVer) > 0 || lastTopChangeVer.compareTo(exchangeVer) > 0) {
-                    U.warn(log, "Stale exchange id for full partition map update (will ignore) [" +
+                if (exchangeVer != null) {
+                    // Ignore if exchange already finished or new exchange started.
+                    if (readyTopVer.compareTo(exchangeVer) > 0 || lastTopChangeVer.compareTo(exchangeVer) > 0) {
+                        U.warn(log, "Stale exchange id for full partition map update (will ignore) [" +
+                            "lastTopChange=" + lastTopChangeVer +
+                            ", readTopVer=" + readyTopVer +
+                            ", exchVer=" + exchangeVer + ']');
+
+                        return false;
+                    }
+                }
+
+                if (msgTopVer != null && lastTopChangeVer.compareTo(msgTopVer) > 0) {
+                    U.warn(log, "Stale version for full partition map update message (will ignore) [" +
                         "lastTopChange=" + lastTopChangeVer +
                         ", readTopVer=" + readyTopVer +
-                        ", exchVer=" + exchangeVer + ']');
+                        ", msgVer=" + msgTopVer + ']');
 
                     return false;
                 }
-            }
-
-            if (msgTopVer != null && lastTopChangeVer.compareTo(msgTopVer) > 0) {
-                U.warn(log, "Stale version for full partition map update message (will ignore) [" +
-                    "lastTopChange=" + lastTopChangeVer +
-                    ", readTopVer=" + readyTopVer +
-                    ", msgVer=" + msgTopVer + ']');
 
-                return false;
-            }
+                boolean fullMapUpdated = (node2part == null);
 
-            boolean fullMapUpdated = (node2part == null);
+                if (node2part != null) {
+                    for (GridDhtPartitionMap part : node2part.values()) {
+                        GridDhtPartitionMap newPart = partMap.get(part.nodeId());
 
-            if (node2part != null) {
-                for (GridDhtPartitionMap part : node2part.values()) {
-                    GridDhtPartitionMap newPart = partMap.get(part.nodeId());
+                        if (shouldOverridePartitionMap(part, newPart)) {
+                            fullMapUpdated = true;
 
-                    if (shouldOverridePartitionMap(part, newPart)) {
-                        fullMapUpdated = true;
+                            if (log.isDebugEnabled()) {
+                                log.debug("Overriding partition map in full update map [exchVer=" + exchangeVer +
+                                    ", curPart=" + mapString(part) +
+                                    ", newPart=" + mapString(newPart) + ']');
+                            }
 
-                        if (log.isDebugEnabled()) {
-                            log.debug("Overriding partition map in full update map [exchVer=" + exchangeVer +
-                                ", curPart=" + mapString(part) +
-                                ", newPart=" + mapString(newPart) + ']');
+                            if (newPart.nodeId().equals(ctx.localNodeId()))
+                                updateSeq.setIfGreater(newPart.updateSequence());
+                        }
+                        else {
+                            // If for some nodes current partition has a newer map,
+                            // then we keep the newer value.
+                            partMap.put(part.nodeId(), part);
                         }
-
-                        if (newPart.nodeId().equals(ctx.localNodeId()))
-                            updateSeq.setIfGreater(newPart.updateSequence());
-                    }
-                    else {
-                        // If for some nodes current partition has a newer map,
-                        // then we keep the newer value.
-                        partMap.put(part.nodeId(), part);
                     }
-                }
 
-                // Check that we have new nodes.
-                for (GridDhtPartitionMap part : partMap.values()) {
-                    if (fullMapUpdated)
-                        break;
+                    // Check that we have new nodes.
+                    for (GridDhtPartitionMap part : partMap.values()) {
+                        if (fullMapUpdated)
+                            break;
 
-                    fullMapUpdated = !node2part.containsKey(part.nodeId());
-                }
+                        fullMapUpdated = !node2part.containsKey(part.nodeId());
+                    }
 
-                // Remove entry if node left.
-                for (Iterator<UUID> it = partMap.keySet().iterator(); it.hasNext(); ) {
-                    UUID nodeId = it.next();
+                    // Remove entry if node left.
+                    for (Iterator<UUID> it = partMap.keySet().iterator(); it.hasNext(); ) {
+                        UUID nodeId = it.next();
 
-                    if (!ctx.discovery().alive(nodeId)) {
-                        if (log.isDebugEnabled())
-                            log.debug("Removing left node from full map update [nodeId=" + nodeId + ", partMap=" +
-                                partMap + ']');
+                        if (!ctx.discovery().alive(nodeId)) {
+                            if (log.isDebugEnabled())
+                                log.debug("Removing left node from full map update [nodeId=" + nodeId + ", partMap=" +
+                                    partMap + ']');
 
-                        it.remove();
+                            it.remove();
+                        }
                     }
                 }
-            }
-            else {
-                GridDhtPartitionMap locNodeMap = partMap.get(ctx.localNodeId());
-
-                if (locNodeMap != null)
-                    updateSeq.setIfGreater(locNodeMap.updateSequence());
-            }
+                else {
+                    GridDhtPartitionMap locNodeMap = partMap.get(ctx.localNodeId());
 
-            if (!fullMapUpdated) {
-                if (log.isDebugEnabled()) {
-                    log.debug("No updates for full partition map (will ignore) [lastExch=" + lastTopChangeVer +
-                        ", exchVer=" + exchangeVer +
-                        ", curMap=" + node2part +
-                        ", newMap=" + partMap + ']');
+                    if (locNodeMap != null)
+                        updateSeq.setIfGreater(locNodeMap.updateSequence());
                 }
 
-                return false;
-            }
+                if (!fullMapUpdated) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("No updates for full partition map (will ignore) [lastExch=" + lastTopChangeVer +
+                            ", exchVer=" + exchangeVer +
+                            ", curMap=" + node2part +
+                            ", newMap=" + partMap + ']');
+                    }
 
-            if (exchangeVer != null) {
-                assert exchangeVer.compareTo(readyTopVer) >= 0 && exchangeVer.compareTo(lastTopChangeVer) >= 0;
+                    return false;
+                }
 
-                lastTopChangeVer = readyTopVer = exchangeVer;
-            }
+                if (exchangeVer != null) {
+                    assert exchangeVer.compareTo(readyTopVer) >= 0 && exchangeVer.compareTo(lastTopChangeVer) >= 0;
 
-            node2part = partMap;
+                    lastTopChangeVer = readyTopVer = exchangeVer;
+                }
 
-            if (exchangeVer == null && !grp.isReplicated() &&
-                    (readyTopVer.initialized() && readyTopVer.compareTo(diffFromAffinityVer) >= 0)) {
-                AffinityAssignment affAssignment = grp.affinity().readyAffinity(readyTopVer);
+                node2part = partMap;
 
-                for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
-                    for (Map.Entry<Integer, GridDhtPartitionState> e0 : e.getValue().entrySet()) {
-                        int p = e0.getKey();
+                if (exchangeVer == null && !grp.isReplicated() &&
+                        (readyTopVer.initialized() && readyTopVer.compareTo(diffFromAffinityVer) >= 0)) {
+                    AffinityAssignment affAssignment = grp.affinity().readyAffinity(readyTopVer);
 
-                        Set<UUID> diffIds = diffFromAffinity.get(p);
+                    for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
+                        for (Map.Entry<Integer, GridDhtPartitionState> e0 : e.getValue().entrySet()) {
+                            int p = e0.getKey();
 
-                        if ((e0.getValue() == MOVING || e0.getValue() == OWNING || e0.getValue() == RENTING) &&
-                            !affAssignment.getIds(p).contains(e.getKey())) {
+                            Set<UUID> diffIds = diffFromAffinity.get(p);
 
-                            if (diffIds == null)
-                                diffFromAffinity.put(p, diffIds = U.newHashSet(3));
+                            if ((e0.getValue() == MOVING || e0.getValue() == OWNING || e0.getValue() == RENTING) &&
+                                !affAssignment.getIds(p).contains(e.getKey())) {
 
-                            diffIds.add(e.getKey());
-                        }
-                        else {
-                            if (diffIds != null && diffIds.remove(e.getKey())) {
-                                if (diffIds.isEmpty())
-                                    diffFromAffinity.remove(p);
+                                if (diffIds == null)
+                                    diffFromAffinity.put(p, diffIds = U.newHashSet(3));
+
+                                diffIds.add(e.getKey());
+                            }
+                            else {
+                                if (diffIds != null && diffIds.remove(e.getKey())) {
+                                    if (diffIds.isEmpty())
+                                        diffFromAffinity.remove(p);
+                                }
                             }
                         }
                     }
-                }
 
-                diffFromAffinityVer = readyTopVer;
-            }
+                    diffFromAffinityVer = readyTopVer;
+                }
 
-            boolean changed = false;
+                boolean changed = false;
 
-            GridDhtPartitionMap nodeMap = partMap.get(ctx.localNodeId());
+                GridDhtPartitionMap nodeMap = partMap.get(ctx.localNodeId());
 
-            if (nodeMap != null && ctx.database().persistenceEnabled() && readyTopVer.initialized()) {
-                for (Map.Entry<Integer, GridDhtPartitionState> e : nodeMap.entrySet()) {
-                    int p = e.getKey();
-                    GridDhtPartitionState state = e.getValue();
+                if (nodeMap != null && ctx.database().persistenceEnabled() && readyTopVer.initialized()) {
+                    for (Map.Entry<Integer, GridDhtPartitionState> e : nodeMap.entrySet()) {
+                        int p = e.getKey();
+                        GridDhtPartitionState state = e.getValue();
 
-                    if (state == OWNING) {
-                        GridDhtLocalPartition locPart = locParts.get(p);
+                        if (state == OWNING) {
+                            GridDhtLocalPartition locPart = locParts.get(p);
 
-                        assert locPart != null : grp.cacheOrGroupName();
+                            assert locPart != null : grp.cacheOrGroupName();
 
-                        if (locPart.state() == MOVING) {
-                            boolean success = locPart.own();
+                            if (locPart.state() == MOVING) {
+                                boolean success = locPart.own();
 
-                            assert success : locPart;
+                                assert success : locPart;
 
-                            changed |= success;
+                                changed |= success;
+                            }
                         }
-                    }
-                    else if (state == MOVING) {
-                        GridDhtLocalPartition locPart = locParts.get(p);
+                        else if (state == MOVING) {
+                            GridDhtLocalPartition locPart = locParts.get(p);
 
-                        if (locPart == null || locPart.state() == EVICTED)
-                            locPart = createPartition(p);
+                            if (locPart == null || locPart.state() == EVICTED)
+                                locPart = createPartition(p);
 
-                        if (locPart.state() == OWNING) {
-                            locPart.moving();
+                            if (locPart.state() == OWNING) {
+                                locPart.moving();
 
-                            changed = true;
+                                changed = true;
+                            }
                         }
-                    }
-                    else if (state == RENTING && partsToReload.contains(p)) {
-                        GridDhtLocalPartition locPart = locParts.get(p);
+                        else if (state == RENTING && partsToReload.contains(p)) {
+                            GridDhtLocalPartition locPart = locParts.get(p);
 
-                        if (locPart == null || locPart.state() == EVICTED) {
-                            createPartition(p);
+                            if (locPart == null || locPart.state() == EVICTED) {
+                                createPartition(p);
 
-                            changed = true;
-                        }
-                        else if (locPart.state() == OWNING || locPart.state() == MOVING) {
-                            locPart.reload(true);
+                                changed = true;
+                            }
+                            else if (locPart.state() == OWNING || locPart.state() == MOVING) {
+                                locPart.reload(true);
 
-                            locPart.rent(false);
+                                locPart.rent(false);
 
-                            changed = true;
+                                changed = true;
+                            }
+                            else
+                                locPart.reload(true);
                         }
-                        else
-                            locPart.reload(true);
                     }
                 }
-            }
 
-            long updateSeq = this.updateSeq.incrementAndGet();
+                long updateSeq = this.updateSeq.incrementAndGet();
 
-            if (readyTopVer.initialized() && readyTopVer.equals(lastTopChangeVer)) {
-                AffinityAssignment  aff = grp.affinity().readyAffinity(readyTopVer);
+                if (readyTopVer.initialized() && readyTopVer.equals(lastTopChangeVer)) {
+                    AffinityAssignment aff = grp.affinity().readyAffinity(readyTopVer);
 
-                if (exchangeVer == null)
-                    changed |= checkEvictions(updateSeq, aff);
+                    if (exchangeVer == null)
+                        changed |= checkEvictions(updateSeq, aff);
 
-                updateRebalanceVersion(aff.assignment());
-            }
+                    updateRebalanceVersion(aff.assignment());
+                }
 
-            consistencyCheck();
+                consistencyCheck();
 
-            if (log.isDebugEnabled())
-                log.debug("Partition map after full update: " + fullMapString());
+                if (log.isDebugEnabled())
+                    log.debug("Partition map after full update: " + fullMapString());
 
-            if (changed)
-                ctx.exchange().scheduleResendPartitions();
+                if (changed)
+                    ctx.exchange().scheduleResendPartitions();
 
-            return changed;
+                return changed;
+            }
+            finally {
+                lock.writeLock().unlock();
+            }
         }
         finally {
-            lock.writeLock().unlock();
+            ctx.database().checkpointReadUnlock();
         }
     }
 
@@ -2188,27 +2212,34 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
 
     /** {@inheritDoc} */
     @Override public void onEvicted(GridDhtLocalPartition part, boolean updateSeq) {
-        lock.writeLock().lock();
+        ctx.database().checkpointReadLock();
 
         try {
-            if (stopping)
-                return;
+            lock.writeLock().lock();
 
-            assert part.state() == EVICTED;
+            try {
+                if (stopping)
+                    return;
 
-            long seq = updateSeq ? this.updateSeq.incrementAndGet() : this.updateSeq.get();
+                assert part.state() == EVICTED;
 
-            if (part.reload())
-                part = createPartition(part.id());
+                long seq = updateSeq ? this.updateSeq.incrementAndGet() : this.updateSeq.get();
 
-            assert lastTopChangeVer.initialized() : lastTopChangeVer;
+                if (part.reload())
+                    part = createPartition(part.id());
 
-            updateLocal(part.id(), part.state(), seq, lastTopChangeVer);
+                assert lastTopChangeVer.initialized() : lastTopChangeVer;
 
-            consistencyCheck();
+                updateLocal(part.id(), part.state(), seq, lastTopChangeVer);
+
+                consistencyCheck();
+            }
+            finally {
+                lock.writeLock().unlock();
+            }
         }
         finally {
-            lock.writeLock().unlock();
+            ctx.database().checkpointReadUnlock();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c219d9b1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 62210dc..426e27f 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -2285,6 +2285,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 for (DbCheckpointListener lsnr : lsnrs)
                     lsnr.onCheckpointBegin(ctx0);
 
+                if (curr.nextSnapshot)
+                    snapshotMgr.onMarkCheckPointBegin(curr.snapshotOperation, map);
+
                 for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
                     if (grp.isLocal())
                         continue;
@@ -2304,8 +2307,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                     cpRec.addCacheGroupState(grp.groupId(), state);
                 }
 
-                if (curr.nextSnapshot)
-                    snapshotMgr.onMarkCheckPointBegin(curr.snapshotOperation, map);
 
                 cpPagesTuple = beginAllCheckpoints();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c219d9b1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
new file mode 100644
index 0000000..3969fb6
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
@@ -0,0 +1,135 @@
+/*
+ * 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.persistence;
+
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgnitePdsExchangeDuringCheckpointTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /**
+     *
+     */
+    public void testExchangeOnNodeLeft() throws Exception {
+        for (int i = 0; i < 5; i++) {
+            startGrids(3);
+            IgniteEx ignite = grid(1);
+            ignite.active(true);
+
+            awaitPartitionMapExchange();
+
+            stopGrid(0, true);
+
+            awaitPartitionMapExchange();
+
+            ignite.context().cache().context().database().wakeupForCheckpoint("test").get(10000);
+
+            afterTest();
+        }
+    }
+
+    /**
+     *
+     */
+    public void testExchangeOnNodeJoin() throws Exception {
+        for (int i = 0; i < 5; i++) {
+            startGrids(2);
+            IgniteEx ignite = grid(1);
+            ignite.active(true);
+
+            awaitPartitionMapExchange();
+
+            IgniteEx ex = startGrid(2);
+
+            awaitPartitionMapExchange();
+
+            ex.context().cache().context().database().wakeupForCheckpoint("test").get(10000);
+
+            afterTest();
+        }
+    }
+
+    /**
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        MemoryConfiguration memCfg = new MemoryConfiguration();
+
+        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+
+        memPlcCfg.setName("dfltMemPlc");
+        memPlcCfg.setInitialSize(100 * 1024 * 1024);
+        memPlcCfg.setMaxSize(1000 * 1024 * 1024);
+
+        memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+        memCfg.setMemoryPolicies(memPlcCfg);
+
+        cfg.setMemoryConfiguration(memCfg);
+
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, 4096));
+
+        cfg.setCacheConfiguration(ccfg);
+
+        PersistentStoreConfiguration psiCfg = new PersistentStoreConfiguration()
+            .setCheckpointingThreads(1)
+            .setCheckpointingFrequency(1)
+            .setWalMode(WALMode.LOG_ONLY);
+
+        cfg.setPersistentStoreConfiguration(psiCfg);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        stopAllGrids();
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c219d9b1/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
index 568af94..6e16d2e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.cache.datastructures.IgniteClientDa
 import org.apache.ignite.internal.processors.cache.datastructures.IgniteClientDiscoveryDataStructuresTest;
 import org.apache.ignite.internal.processors.cache.datastructures.IgniteDataStructureUniqueNameTest;
 import org.apache.ignite.internal.processors.cache.datastructures.IgniteDataStructureWithJobTest;
+import org.apache.ignite.internal.processors.cache.datastructures.SemaphoreFailoverSafeReleasePermitsTest;
 import org.apache.ignite.internal.processors.cache.datastructures.local.GridCacheLocalAtomicQueueApiSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.local.GridCacheLocalAtomicSetSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.local.GridCacheLocalQueueApiSelfTest;
@@ -129,8 +130,7 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(IgnitePartitionedCountDownLatchSelfTest.class));
         suite.addTest(new TestSuite(IgniteDataStructureWithJobTest.class));
         suite.addTest(new TestSuite(IgnitePartitionedSemaphoreSelfTest.class));
-        // TODO https://issues.apache.org/jira/browse/IGNITE-4173, enable when fixed.
-        // suite.addTest(new TestSuite(SemaphoreFailoverSafeReleasePermitsTest.class));
+        suite.addTest(new TestSuite(SemaphoreFailoverSafeReleasePermitsTest.class));
         // TODO IGNITE-3141, enabled when fixed.
         // suite.addTest(new TestSuite(IgnitePartitionedLockSelfTest.class));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c219d9b1/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
index ab8ff81..29ea64c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
@@ -20,6 +20,7 @@ package org.apache.ignite.testsuites;
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes;
+import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsExchangeDuringCheckpointTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsPageSizesTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsRecoveryAfterFileCorruptionTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePersistenceMetricsSelfTest;
@@ -73,6 +74,9 @@ public class IgnitePdsTestSuite2 extends TestSuite {
         suite.addTestSuite(IgniteWalFlushFailoverTest.class);
 
         suite.addTestSuite(IgniteWalReaderTest.class);
+
+        suite.addTestSuite(IgnitePdsExchangeDuringCheckpointTest.class);
+
         return suite;
     }
 }


[15/17] ignite git commit: ignite-3479

Posted by sb...@apache.org.
ignite-3479


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

Branch: refs/heads/ignite-3479
Commit: 3888d69cec6180af84c4bf90a39d60790ae5b1c8
Parents: 58fc586
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 26 11:37:56 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 26 12:44:32 2017 +0300

----------------------------------------------------------------------
 .../communication/GridIoMessageFactory.java     |   6 +
 .../GridDistributedTxRemoteAdapter.java         |   8 +-
 .../distributed/dht/GridDhtTxFinishFuture.java  |  15 +-
 .../distributed/dht/GridDhtTxFinishRequest.java |  20 +--
 .../distributed/dht/GridDhtTxPrepareFuture.java |  15 +-
 .../dht/GridDhtTxPrepareRequest.java            |  18 +--
 .../dht/GridPartitionedGetFuture.java           |  67 +++++----
 .../GridDhtPartitionsExchangeFuture.java        |   6 +-
 .../GridNearPessimisticTxPrepareFuture.java     |  33 +++--
 .../near/GridNearTxFinishAndAckFuture.java      |  10 +-
 .../near/GridNearTxFinishFuture.java            |  17 ++-
 .../near/GridNearTxFinishRequest.java           |  18 +--
 .../near/GridNearTxPrepareResponse.java         |  20 +--
 .../mvcc/CacheCoordinatorsSharedManager.java    |  36 ++---
 .../processors/cache/mvcc/MvccQueryFuture.java  |   3 +-
 .../cache/mvcc/MvccResponseListener.java        |  10 +-
 .../processors/cache/mvcc/TxMvccInfo.java       | 141 +++++++++++++++++++
 .../cache/transactions/IgniteInternalTx.java    |   6 +-
 .../cache/transactions/IgniteTxAdapter.java     |  17 ++-
 .../cache/transactions/IgniteTxHandler.java     |   6 +-
 .../transactions/IgniteTxLocalAdapter.java      |  10 +-
 21 files changed, 334 insertions(+), 148 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 9bd04fa..22d2779 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -110,6 +110,7 @@ import org.apache.ignite.internal.processors.cache.mvcc.CoordinatorFutureRespons
 import org.apache.ignite.internal.processors.cache.mvcc.CoordinatorTxCounterRequest;
 import org.apache.ignite.internal.processors.cache.mvcc.CoordinatorWaitTxsRequest;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersionResponse;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse;
 import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
@@ -923,6 +924,11 @@ public class GridIoMessageFactory implements MessageFactory {
 
                 return msg;
 
+            case 139:
+                msg = new TxMvccInfo();
+
+                return msg;
+
 
             // [-3..119] [124..128] [-23..-27] [-36..-55]- this
             // [120..123] - DR

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index a31f91b..77039cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -474,7 +474,7 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
                     cctx.database().checkpointReadLock();
 
                     try {
-                        assert !txState.mvccEnabled(cctx) || mvccVer != null;
+                        assert !txState.mvccEnabled(cctx) || mvccInfo != null;
 
                         Collection<IgniteTxEntry> entries = near() ? allEntries() : writeEntries();
 
@@ -597,7 +597,7 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
                                                         resolveTaskName(),
                                                         dhtVer,
                                                         txEntry.updateCounter(),
-                                                        mvccVer);
+                                                        mvccInfo != null ? mvccInfo.version() : null);
                                                 else {
                                                     assert val != null : txEntry;
 
@@ -622,7 +622,7 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
                                                         resolveTaskName(),
                                                         dhtVer,
                                                         txEntry.updateCounter(),
-                                                        mvccVer);
+                                                        mvccInfo != null ? mvccInfo.version() : null);
 
                                                     // Keep near entry up to date.
                                                     if (nearCached != null) {
@@ -655,7 +655,7 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
                                                     resolveTaskName(),
                                                     dhtVer,
                                                     txEntry.updateCounter(),
-                                                    mvccVer);
+                                                    mvccInfo != null ? mvccInfo.version() : null);
 
                                                 // Keep near entry up to date.
                                                 if (nearCached != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
index 31f12b5..d624e2c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
@@ -35,6 +35,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheCompoundIdentityFutu
 import org.apache.ignite.internal.processors.cache.GridCacheFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxMapping;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -295,11 +296,11 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCacheCompoundIdentity
         GridLongList waitTxs = tx.mvccWaitTransactions();
 
         if (waitTxs != null) {
-            ClusterNode crd = cctx.coordinators().currentCoordinator();
+            TxMvccInfo mvccInfo = tx.mvccInfo();
 
-            assert crd != null;
+            assert mvccInfo != null;
 
-            IgniteInternalFuture fut = cctx.coordinators().waitTxsFuture(crd, waitTxs);
+            IgniteInternalFuture fut = cctx.coordinators().waitTxsFuture(mvccInfo.coordinator(), waitTxs);
 
             add(fut);
 
@@ -411,7 +412,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCacheCompoundIdentity
         if (tx.onePhaseCommit())
             return false;
 
-        assert !commit || !tx.txState().mvccEnabled(cctx) || tx.mvccCoordinatorVersion() != null;
+        assert !commit || !tx.txState().mvccEnabled(cctx) || tx.mvccInfo() != null;
 
         boolean sync = tx.syncMode() == FULL_SYNC;
 
@@ -469,7 +470,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCacheCompoundIdentity
                 updCntrs,
                 false,
                 false,
-                tx.mvccCoordinatorVersion());
+                tx.mvccInfo());
 
             req.writeVersion(tx.writeVersion() != null ? tx.writeVersion() : tx.xidVersion());
 
@@ -539,7 +540,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCacheCompoundIdentity
                     tx.activeCachesDeploymentEnabled(),
                     false,
                     false,
-                    tx.mvccCoordinatorVersion());
+                    tx.mvccInfo());
 
                 req.writeVersion(tx.writeVersion());
 
@@ -582,6 +583,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCacheCompoundIdentity
     @SuppressWarnings("unchecked")
     @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext ctx) {
         if (!isDone()) {
+            // TODO IGNITE-3478 (mvcc wait txs fut)
             for (IgniteInternalFuture fut : futures()) {
                 if (!fut.isDone()) {
                     MiniFuture f = (MiniFuture)fut;
@@ -608,6 +610,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCacheCompoundIdentity
 
     /** {@inheritDoc} */
     @Override public String toString() {
+        // TODO IGNITE-3478 (mvcc wait txs fut)
         Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
             @SuppressWarnings("unchecked")
             @Override public String apply(IgniteInternalFuture<?> f) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
index df8c951..0df0b66 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
@@ -25,7 +25,7 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishRequest;
-import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -68,7 +68,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
     private GridCacheVersion writeVer;
 
     /** */
-    private MvccCoordinatorVersion mvccVer;
+    private TxMvccInfo mvccInfo;
 
     /**
      * Empty constructor required for {@link Externalizable}.
@@ -126,7 +126,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
         boolean addDepInfo,
         boolean retVal,
         boolean waitRemoteTxs,
-        MvccCoordinatorVersion mvccVer
+        TxMvccInfo mvccInfo
     ) {
         super(
             xidVer,
@@ -155,7 +155,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
         this.nearNodeId = nearNodeId;
         this.isolation = isolation;
         this.miniId = miniId;
-        this.mvccVer = mvccVer;
+        this.mvccInfo = mvccInfo;
 
         needReturnValue(retVal);
         waitRemoteTransactions(waitRemoteTxs);
@@ -213,7 +213,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
         Collection<Long> updateIdxs,
         boolean retVal,
         boolean waitRemoteTxs,
-        MvccCoordinatorVersion mvccVer
+        TxMvccInfo mvccInfo
     ) {
         this(nearNodeId,
             futId,
@@ -239,7 +239,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
             addDepInfo,
             retVal,
             waitRemoteTxs,
-            mvccVer);
+            mvccInfo);
 
         if (updateIdxs != null && !updateIdxs.isEmpty()) {
             partUpdateCnt = new GridLongList(updateIdxs.size());
@@ -252,8 +252,8 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
     /**
      * @return Counter.
      */
-    public MvccCoordinatorVersion mvccCoordinatorVersion() {
-        return mvccVer;
+    public TxMvccInfo mvccInfo() {
+        return mvccInfo;
     }
 
     /**
@@ -382,7 +382,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
                 writer.incrementState();
 
             case 23:
-                if (!writer.writeMessage("mvccVer", mvccVer))
+                if (!writer.writeMessage("mvccInfo", mvccInfo))
                     return false;
 
                 writer.incrementState();
@@ -448,7 +448,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
                 reader.incrementState();
 
             case 23:
-                mvccVer = reader.readMessage("mvccVer");
+                mvccInfo = reader.readMessage("mvccInfo");
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/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 0431224..8795007 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
@@ -63,6 +63,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPr
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccResponseListener;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
@@ -872,7 +873,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             tx.onePhaseCommit(),
             tx.activeCachesDeploymentEnabled());
 
-        res.mvccCoordinatorVersion(tx.mvccCoordinatorVersion());
+        res.mvccInfo(tx.mvccInfo());
 
         if (prepErr == null) {
             if (tx.needReturnValue() || tx.nearOnOriginatingNode() || tx.hasInterceptor())
@@ -1239,7 +1240,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
                 assert crd != null : tx.topologyVersion();
 
                 if (crd.isLocal())
-                    tx.mvccCoordinatorVersion(cctx.coordinators().requestTxCounterOnCoordinator(tx));
+                    onMvccResponse(cctx.localNodeId(), cctx.coordinators().requestTxCounterOnCoordinator(tx));
                 else {
                     IgniteInternalFuture<Long> crdCntrFut = cctx.coordinators().requestTxCounter(crd, this, tx.nearXidVersion());
 
@@ -1302,8 +1303,8 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
     }
 
     /** {@inheritDoc} */
-    @Override public void onMvccResponse(MvccCoordinatorVersion res) {
-        tx.mvccCoordinatorVersion(res);
+    @Override public void onMvccResponse(UUID crdId, MvccCoordinatorVersion res) {
+        tx.mvccInfo(new TxMvccInfo(crdId, res));
     }
 
     /** {@inheritDoc} */
@@ -1325,7 +1326,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             }
         }
 
-        assert !tx.txState().mvccEnabled(cctx) || !tx.onePhaseCommit() || tx.mvccCoordinatorVersion() != null;
+        assert !tx.txState().mvccEnabled(cctx) || !tx.onePhaseCommit() || tx.mvccInfo() != null;
 
         int miniId = 0;
 
@@ -1376,7 +1377,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
                 tx.activeCachesDeploymentEnabled(),
                 tx.storeWriteThrough(),
                 retVal,
-                tx.mvccCoordinatorVersion());
+                tx.mvccInfo());
 
             int idx = 0;
 
@@ -1490,7 +1491,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
                     tx.activeCachesDeploymentEnabled(),
                     tx.storeWriteThrough(),
                     retVal,
-                    tx.mvccCoordinatorVersion());
+                    tx.mvccInfo());
 
                 for (IgniteTxEntry entry : nearMapping.entries()) {
                     if (CU.writes().apply(entry)) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
index da7f831..e099a32 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
@@ -34,7 +34,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest;
-import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -105,7 +105,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
     private List<IgniteTxKey> nearWritesCacheMissed;
 
     /** */
-    private MvccCoordinatorVersion mvccVer;
+    private TxMvccInfo mvccInfo;
 
     /**
      * Empty constructor required for {@link Externalizable}.
@@ -146,7 +146,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
         boolean addDepInfo,
         boolean storeWriteThrough,
         boolean retVal,
-        MvccCoordinatorVersion mvccVer) {
+        TxMvccInfo mvccInfo) {
         super(tx,
             timeout,
             null,
@@ -175,14 +175,14 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
 
         nearNodeId = tx.nearNodeId();
 
-        this.mvccVer = mvccVer;
+        this.mvccInfo = mvccInfo;
     }
 
     /**
-     * @return Counter.
+     * @return Mvcc info.
      */
-    public MvccCoordinatorVersion mvccCoordinatorVersion() {
-        return mvccVer;
+    public TxMvccInfo mvccInfo() {
+        return mvccInfo;
     }
 
     /**
@@ -421,7 +421,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
                 writer.incrementState();
 
             case 23:
-                if (!writer.writeMessage("mvccVer", mvccVer))
+                if (!writer.writeMessage("mvccInfo", mvccInfo))
                     return false;
 
                 writer.incrementState();
@@ -521,7 +521,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
                 reader.incrementState();
 
             case 23:
-                mvccVer = reader.readMessage("mvccVer");
+                mvccInfo = reader.readMessage("mvccInfo");
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/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 11d81a3..6c74ecd 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
@@ -42,6 +42,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryFuture;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse;
@@ -65,7 +66,7 @@ import org.jetbrains.annotations.Nullable;
 /**
  * Colocated get future.
  */
-public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAdapter<K, V> {
+public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAdapter<K, V> implements MvccQueryFuture {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -136,6 +137,11 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
             log = U.logger(cctx.kernalContext(), logRef, GridPartitionedGetFuture.class);
     }
 
+    /** {@inheritDoc} */
+    @Nullable @Override public MvccCoordinatorVersion onCoordinatorChange(ClusterNode oldCrd, ClusterNode newCrd) {
+        return null;
+    }
+
     /**
      * Initializes future.
      */
@@ -154,39 +160,52 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
 
         // TODO IGNITE-3478 (correct failover and remap).
         if (cctx.mvccEnabled()) {
-            mvccCrd = cctx.affinity().mvccCoordinator(topVer);
-
-            if (mvccCrd == null) {
-                onDone(new ClusterTopologyCheckedException("Mvcc coordinator is not assigned: " + topVer));
 
-                return;
-            }
+            return;
+        }
 
-            IgniteInternalFuture<MvccCoordinatorVersion> cntrFut = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
+        map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer);
 
-            cntrFut.listen(new IgniteInClosure<IgniteInternalFuture<MvccCoordinatorVersion>>() {
-                @Override public void apply(IgniteInternalFuture<MvccCoordinatorVersion> fut) {
-                    try {
-                        mvccVer = fut.get();
+        markInitialized();
+    }
 
-                        map(keys,
-                            Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(),
-                            GridPartitionedGetFuture.this.topVer);
+    /**
+     *
+     */
+    private void requestMvccVersion(final AffinityTopologyVersion topVer) {
+        mvccCrd = cctx.affinity().mvccCoordinator(topVer);
 
-                        markInitialized();
-                    }
-                    catch (IgniteCheckedException e) {
-                        onDone(e);
-                    }
-                }
-            });
+        if (mvccCrd == null) {
+            onDone(new IgniteCheckedException("Mvcc coordinator is not assigned: " + topVer));
 
             return;
         }
 
-        map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer);
+        IgniteInternalFuture<MvccCoordinatorVersion> cntrFut = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
 
-        markInitialized();
+        cntrFut.listen(new IgniteInClosure<IgniteInternalFuture<MvccCoordinatorVersion>>() {
+            @Override public void apply(IgniteInternalFuture<MvccCoordinatorVersion> fut) {
+                try {
+                    mvccVer = fut.get();
+
+                    map(keys,
+                        Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(),
+                        topVer);
+
+                    markInitialized();
+                }
+                catch (ClusterTopologyCheckedException e) {
+                    if (canRemap) {
+
+                    }
+                    else
+                        onDone(new ClusterTopologyCheckedException("Failed to request mvcc version, coordinator failed: " + mvccCrd));
+                }
+                catch (IgniteCheckedException e) {
+                    onDone(e);
+                }
+            }
+        });
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/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 47e1f17..30e5621 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
@@ -561,9 +561,13 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                 ClusterNode mvccCrd = cctx.coordinators().currentCoordinator();
 
                 if (mvccCrd != null && mvccCrd.equals(exchId.eventNode())) {
+                    assert !CU.clientNode(mvccCrd) : mvccCrd;
+
                     ClusterNode newMvccCrd = cctx.coordinators().reassignCoordinator(firstEvtDiscoCache);
 
-                    mvccCrdChange = !Objects.equals(mvccCrd, newMvccCrd);
+                    assert !F.eq(mvccCrd, newMvccCrd);
+
+                    mvccCrdChange = newMvccCrd != null;
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index 8247b46..75a2b87 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxMapp
 import org.apache.ignite.internal.processors.cache.mvcc.CacheCoordinatorsSharedManager;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccResponseListener;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
@@ -271,16 +272,6 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
 
         ClusterNode mvccCrd = null;
 
-        if (tx.txState().mvccEnabled(cctx)) {
-            mvccCrd = cctx.coordinators().coordinator(topVer);
-
-            if (mvccCrd == null) {
-                onDone(new ClusterTopologyCheckedException("Mvcc coordinator is not assigned: " + topVer));
-
-                return;
-            }
-        }
-
         GridDhtTxMapping txMapping = new GridDhtTxMapping();
 
         boolean hasNearCache = false;
@@ -303,6 +294,16 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
             else
                 nodes = cacheCtx.affinity().nodesByKey(txEntry.key(), topVer);
 
+            if (mvccCrd == null && cacheCtx.mvccEnabled()) {
+                mvccCrd = cacheCtx.affinity().mvccCoordinator(topVer);
+
+                if (mvccCrd == null) {
+                    onDone(new IgniteCheckedException("Mvcc coordinator is not assigned: " + topVer));
+
+                    return;
+                }
+            }
+
             if (F.isEmpty(nodes)) {
                 onDone(new ClusterTopologyServerNotFoundException("Failed to map keys to nodes (partition " +
                     "is not mapped to any node) [key=" + txEntry.key() +
@@ -325,6 +326,8 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
             txMapping.addMapping(nodes);
         }
 
+        assert !tx.txState().mvccEnabled(cctx) || mvccCrd != null;
+
         tx.transactionNodes(txMapping.transactionNodes());
 
         if (!hasNearCache)
@@ -430,7 +433,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
             if (mvccCrd.isLocal()) {
                 MvccCoordinatorVersion mvccVer = cctx.coordinators().requestTxCounterOnCoordinator(tx);
 
-                tx.mvccCoordinatorVersion(mvccVer);
+                onMvccResponse(cctx.localNodeId(), mvccVer);
             }
             else {
                 IgniteInternalFuture<Long> cntrFut = cctx.coordinators().requestTxCounter(mvccCrd, this, tx.nearXidVersion());
@@ -443,8 +446,8 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
     }
 
     /** {@inheritDoc} */
-    @Override public void onMvccResponse(MvccCoordinatorVersion res) {
-        tx.mvccCoordinatorVersion(res);
+    @Override public void onMvccResponse(UUID crdId, MvccCoordinatorVersion res) {
+        tx.mvccInfo(new TxMvccInfo(crdId, res));
     }
 
     /** {@inheritDoc} */
@@ -544,8 +547,8 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
             if (res.error() != null)
                 onError(res.error());
             else {
-                if (res.mvccCoordinatorVersion() != null)
-                    tx.mvccCoordinatorVersion(res.mvccCoordinatorVersion());
+                if (res.mvccInfo() != null)
+                    tx.mvccInfo(res.mvccInfo());
 
                 onPrepareResponse(m, res, updateMapping);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishAndAckFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishAndAckFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishAndAckFuture.java
index 7d03d46..c24551b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishAndAckFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishAndAckFuture.java
@@ -18,8 +18,8 @@
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -53,13 +53,11 @@ public class GridNearTxFinishAndAckFuture extends GridFutureAdapter<IgniteIntern
                 @Override public void apply(final GridNearTxFinishFuture fut) {
                     GridNearTxLocal tx = fut.tx();
 
-                    if (tx.mvccCoordinatorVersion() != null) {
-                        ClusterNode crd = fut.context().coordinators().coordinator(tx.topologyVersion());
-
-                        assert crd != null;
+                    TxMvccInfo mvccInfo = tx.mvccInfo();
 
+                    if (mvccInfo != null) {
                         IgniteInternalFuture<Void> ackFut = fut.context().coordinators().ackTxCommit(
-                            crd, tx.mvccCoordinatorVersion());
+                            mvccInfo.coordinator(), mvccInfo.version());
 
                         ackFut.listen(new IgniteInClosure<IgniteInternalFuture<Void>>() {
                             @Override public void apply(IgniteInternalFuture<Void> ackFut) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/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 347a694..a9b60d7 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
@@ -42,6 +42,7 @@ 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.GridDhtTxFinishRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -420,12 +421,10 @@ public final class GridNearTxFinishFuture<K, V> extends GridCacheCompoundIdentit
             return;
         }
 
-        if (!commit && tx.mvccCoordinatorVersion() != null) {
-            ClusterNode crd = cctx.coordinators().coordinator(tx.topologyVersion());
+        if (!commit && tx.mvccInfo() != null) {
+            TxMvccInfo mvccInfo = tx.mvccInfo();
 
-            assert crd != null;
-
-            cctx.coordinators().ackTxRollback(crd, tx.mvccCoordinatorVersion());
+            cctx.coordinators().ackTxRollback(mvccInfo.coordinator(), mvccInfo.version());
         }
 
         try {
@@ -433,11 +432,11 @@ public final class GridNearTxFinishFuture<K, V> extends GridCacheCompoundIdentit
                 GridLongList waitTxs = tx.mvccWaitTransactions();
 
                 if (waitTxs != null) {
-                    ClusterNode crd = cctx.coordinators().coordinator(tx.topologyVersion());
+                    TxMvccInfo mvccInfo = tx.mvccInfo();
 
-                    assert crd != null;
+                    assert mvccInfo != null;
 
-                    IgniteInternalFuture fut = cctx.coordinators().waitTxsFuture(crd, waitTxs);
+                    IgniteInternalFuture fut = cctx.coordinators().waitTxsFuture(mvccInfo.coordinator(), waitTxs);
 
                     add(fut);
                 }
@@ -752,7 +751,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCacheCompoundIdentit
             tx.size(),
             tx.subjectId(),
             tx.taskNameHash(),
-            tx.mvccCoordinatorVersion(),
+            tx.mvccInfo(),
             tx.activeCachesDeploymentEnabled()
         );
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
index 918724e..d436aed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
@@ -24,7 +24,7 @@ import java.util.UUID;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishRequest;
-import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
 import org.apache.ignite.lang.IgniteUuid;
@@ -44,7 +44,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishRequest {
     private int miniId;
 
     /** */
-    private MvccCoordinatorVersion mvccVer;
+    private TxMvccInfo mvccInfo;
 
     /**
      * Empty constructor required for {@link Externalizable}.
@@ -91,7 +91,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishRequest {
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash,
-        MvccCoordinatorVersion mvccVer,
+        TxMvccInfo mvccInfo,
         boolean addDepInfo) {
         super(
             xidVer,
@@ -116,14 +116,14 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishRequest {
         explicitLock(explicitLock);
         storeEnabled(storeEnabled);
 
-        this.mvccVer = mvccVer;
+        this.mvccInfo = mvccInfo;
     }
 
     /**
-     * @return Counter.
+     * @return Mvcc info.
      */
-    public MvccCoordinatorVersion mvccCoordinatorVersion() {
-        return mvccVer;
+    @Nullable public TxMvccInfo mvccInfo() {
+        return mvccInfo;
     }
 
     /**
@@ -192,7 +192,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishRequest {
                 writer.incrementState();
 
             case 22:
-                if (!writer.writeMessage("mvccVer", mvccVer))
+                if (!writer.writeMessage("mvccInfo", mvccInfo))
                     return false;
 
                 writer.incrementState();
@@ -222,7 +222,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishRequest {
                 reader.incrementState();
 
             case 22:
-                mvccVer = reader.readMessage("mvccVer");
+                mvccInfo = reader.readMessage("mvccInfo");
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index 7fe2e53..10883de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -33,7 +33,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheReturn;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareResponse;
-import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -99,7 +99,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
     private AffinityTopologyVersion clientRemapVer;
 
     /** */
-    private MvccCoordinatorVersion mvccVer;
+    private TxMvccInfo mvccInfo;
 
     /**
      * Empty constructor required by {@link Externalizable}.
@@ -150,17 +150,17 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
     }
 
     /**
-     * @param mvccVer Mvcc version.
+     * @param mvccInfo Mvcc info.
      */
-    public void mvccCoordinatorVersion(MvccCoordinatorVersion mvccVer) {
-        this.mvccVer = mvccVer;
+    public void mvccInfo(TxMvccInfo mvccInfo) {
+        this.mvccInfo = mvccInfo;
     }
 
     /**
-     * @return Mvcc version.
+     * @return Mvcc info.
      */
-    public MvccCoordinatorVersion mvccCoordinatorVersion() {
-        return mvccVer;
+    @Nullable public TxMvccInfo mvccInfo() {
+        return mvccInfo;
     }
 
     /**
@@ -407,7 +407,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
                 writer.incrementState();
 
             case 15:
-                if (!writer.writeMessage("mvccVer", mvccVer))
+                if (!writer.writeMessage("mvccInfo", mvccInfo))
                     return false;
 
                 writer.incrementState();
@@ -499,7 +499,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
                 reader.incrementState();
 
             case 15:
-                mvccVer = reader.readMessage("mvccVer");
+                mvccInfo = reader.readMessage("mvccInfo");
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java
index ea44df1..dff1b53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java
@@ -235,22 +235,22 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
     }
 
     /**
-     * @param crd Coordinator.
+     * @param crdId Coordinator ID.
      * @param txs Transaction IDs.
      * @return Future.
      */
-    public IgniteInternalFuture<Void> waitTxsFuture(ClusterNode crd, GridLongList txs) {
-        assert crd != null;
+    public IgniteInternalFuture<Void> waitTxsFuture(UUID crdId, GridLongList txs) {
+        assert crdId != null;
         assert txs != null && txs.size() > 0;
 
         // TODO IGNITE-3478: special case for local?
 
-        WaitAckFuture fut = new WaitAckFuture(futIdCntr.incrementAndGet(), crd, false);
+        WaitAckFuture fut = new WaitAckFuture(futIdCntr.incrementAndGet(), crdId, false);
 
         ackFuts.put(fut.id, fut);
 
         try {
-            cctx.gridIO().sendToGridTopic(crd,
+            cctx.gridIO().sendToGridTopic(crdId,
                 MSG_TOPIC,
                 new CoordinatorWaitTxsRequest(fut.id, txs),
                 MSG_POLICY);
@@ -272,7 +272,7 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
      * @param mvccVer Transaction version.
      * @return Acknowledge future.
      */
-    public IgniteInternalFuture<Void> ackTxCommit(ClusterNode crd, MvccCoordinatorVersion mvccVer) {
+    public IgniteInternalFuture<Void> ackTxCommit(UUID crd, MvccCoordinatorVersion mvccVer) {
         assert crd != null;
         assert mvccVer != null;
 
@@ -299,26 +299,26 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
     }
 
     /**
-     * @param crd Coordinator.
+     * @param crdId Coordinator node ID.
      * @param mvccVer Transaction version.
      */
-    public void ackTxRollback(ClusterNode crd, MvccCoordinatorVersion mvccVer) {
+    public void ackTxRollback(UUID crdId, MvccCoordinatorVersion mvccVer) {
         CoordinatorTxAckRequest msg = new CoordinatorTxAckRequest(0, mvccVer.counter());
 
         msg.skipResponse(true);
 
         try {
-            cctx.gridIO().sendToGridTopic(crd,
+            cctx.gridIO().sendToGridTopic(crdId,
                 MSG_TOPIC,
                 msg,
                 MSG_POLICY);
         }
         catch (ClusterTopologyCheckedException e) {
             if (log.isDebugEnabled())
-                log.debug("Failed to send tx rollback ack, node left [msg=" + msg + ", node=" + crd.id() + ']');
+                log.debug("Failed to send tx rollback ack, node left [msg=" + msg + ", node=" + crdId + ']');
         }
         catch (IgniteCheckedException e) {
-            U.error(log, "Failed to send tx rollback ack [msg=" + msg + ", node=" + crd.id() + ']', e);
+            U.error(log, "Failed to send tx rollback ack [msg=" + msg + ", node=" + crdId + ']', e);
         }
     }
 
@@ -761,7 +761,7 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
             assert res.counter() != COUNTER_NA;
 
             if (lsnr != null)
-                lsnr.onMvccResponse(res);
+                lsnr.onMvccResponse(crd.id(), res);
 
             onDone(res);
         }
@@ -801,7 +801,7 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
         private final long id;
 
         /** */
-        private final ClusterNode crd;
+        private final UUID crdId;
 
         /** */
         long startTime;
@@ -811,11 +811,11 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
 
         /**
          * @param id Future ID.
-         * @param crd Coordinator.
+         * @param crdId Coordinator node ID.
          */
-        WaitAckFuture(long id, ClusterNode crd, boolean ackTx) {
+        WaitAckFuture(long id, UUID crdId, boolean ackTx) {
             this.id = id;
-            this.crd = crd;
+            this.crdId = crdId;
             this.ackTx = ackTx;
 
             if (STAT_CNTRS)
@@ -833,13 +833,13 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
          * @param nodeId Failed node ID.
          */
         void onNodeLeft(UUID nodeId) {
-            if (crd.id().equals(nodeId) && verFuts.remove(id) != null)
+            if (crdId.equals(nodeId) && verFuts.remove(id) != null)
                 onDone();
         }
 
         /** {@inheritDoc} */
         @Override public String toString() {
-            return "WaitAckFuture [crd=" + crd + ", id=" + id + ']';
+            return "WaitAckFuture [crdId=" + crdId + ", id=" + id + ']';
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java
index 62160e1..1463577 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java
@@ -18,10 +18,11 @@
 package org.apache.ignite.internal.processors.cache.mvcc;
 
 import org.apache.ignite.cluster.ClusterNode;
+import org.jetbrains.annotations.Nullable;
 
 /**
  *
  */
 public interface MvccQueryFuture {
-    void coordinatorChanged(ClusterNode node);
+    @Nullable public MvccCoordinatorVersion onCoordinatorChange(ClusterNode oldCrd, ClusterNode newCrd);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccResponseListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccResponseListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccResponseListener.java
index 11d0da0..627a007 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccResponseListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccResponseListener.java
@@ -17,13 +17,21 @@
 
 package org.apache.ignite.internal.processors.cache.mvcc;
 
+import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
 
 /**
  *
  */
 public interface MvccResponseListener {
-    public void onMvccResponse(MvccCoordinatorVersion res);
+    /**
+     * @param crdId Coordinator node ID.
+     * @param res Version.
+     */
+    public void onMvccResponse(UUID crdId, MvccCoordinatorVersion res);
 
+    /**
+     * @param e Error.
+     */
     public void onMvccError(IgniteCheckedException e);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/TxMvccInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/TxMvccInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/TxMvccInfo.java
new file mode 100644
index 0000000..428d707
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/TxMvccInfo.java
@@ -0,0 +1,141 @@
+/*
+ * 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.mvcc;
+
+import java.nio.ByteBuffer;
+import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+
+/**
+ *
+ */
+public class TxMvccInfo implements Message {
+    /** */
+    private UUID crd;
+
+    /** */
+    private MvccCoordinatorVersion mvccVer;
+
+    /**
+     *
+     */
+    public TxMvccInfo() {
+        // No-op.
+    }
+
+    /**
+     * @param crd
+     * @param mvccVer
+     */
+    public TxMvccInfo(UUID crd, MvccCoordinatorVersion mvccVer) {
+        assert crd != null;
+        assert mvccVer != null;
+
+        this.crd = crd;
+        this.mvccVer = mvccVer;
+    }
+
+    public UUID coordinator() {
+        return crd;
+    }
+
+    public MvccCoordinatorVersion version() {
+        return mvccVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 0:
+                if (!writer.writeUuid("crd", crd))
+                    return false;
+
+                writer.incrementState();
+
+            case 1:
+                if (!writer.writeMessage("mvccVer", mvccVer))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        switch (reader.state()) {
+            case 0:
+                crd = reader.readUuid("crd");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 1:
+                mvccVer = reader.readMessage("mvccVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(TxMvccInfo.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public short directType() {
+        return 139;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 2;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onAckReceived() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TxMvccInfo.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/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 091ecc5..5009bd3 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
@@ -30,7 +30,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedExceptio
 import org.apache.ignite.internal.processors.cache.GridCacheFilterFailedException;
 import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
 import org.apache.ignite.internal.util.lang.GridTuple;
@@ -637,7 +637,7 @@ public interface IgniteInternalTx {
     public void commitError(Throwable e);
 
     /**
-     * @param mvccVer Version.
+     * @param mvccInfo Mvcc information.
      */
-    public void mvccCoordinatorVersion(MvccCoordinatorVersion mvccVer);
+    public void mvccInfo(TxMvccInfo mvccInfo);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/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 ee7dfd2..3b6db58 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
@@ -59,7 +59,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheReturn;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
-import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
 import org.apache.ignite.internal.processors.cache.store.CacheStoreManager;
 import org.apache.ignite.internal.processors.cache.version.GridCacheLazyPlainVersionedEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -254,7 +254,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
     protected ConsistentIdMapper consistentIdMapper;
 
     /** */
-    protected MvccCoordinatorVersion mvccVer;
+    protected TxMvccInfo mvccInfo;
 
     /**
      * Empty constructor required for {@link Externalizable}.
@@ -374,13 +374,16 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
         consistentIdMapper = new ConsistentIdMapper(cctx.discovery());
     }
 
-    public MvccCoordinatorVersion mvccCoordinatorVersion() {
-        return mvccVer;
+    /**
+     * @return Mvcc info.
+     */
+    @Nullable public TxMvccInfo mvccInfo() {
+        return mvccInfo;
     }
 
     /** {@inheritDoc} */
-    @Override public void mvccCoordinatorVersion(MvccCoordinatorVersion mvccVer) {
-        this.mvccVer = mvccVer;
+    @Override public void mvccInfo(TxMvccInfo mvccInfo) {
+        this.mvccInfo = mvccInfo;
     }
 
     /**
@@ -1893,7 +1896,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
         }
 
         /** {@inheritDoc} */
-        @Override public void mvccCoordinatorVersion(MvccCoordinatorVersion mvccVer) {
+        @Override public void mvccInfo(TxMvccInfo mvccInfo) {
             // No-op.
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index ff7de90..24f2a8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -862,7 +862,7 @@ public class IgniteTxHandler {
             tx = ctx.tm().tx(dhtVer);
 
         if (tx != null) {
-            tx.mvccCoordinatorVersion(req.mvccCoordinatorVersion());
+            tx.mvccInfo(req.mvccInfo());
 
             req.txState(tx.txState());
         }
@@ -1314,7 +1314,7 @@ public class IgniteTxHandler {
                 tx.commitVersion(req.commitVersion());
                 tx.invalidate(req.isInvalidate());
                 tx.systemInvalidate(req.isSystemInvalidate());
-                tx.mvccCoordinatorVersion(req.mvccCoordinatorVersion());
+                tx.mvccInfo(req.mvccInfo());
 
                 // Complete remote candidates.
                 tx.doneRemote(req.baseVersion(), null, null, null);
@@ -1361,7 +1361,7 @@ public class IgniteTxHandler {
         try {
             tx.commitVersion(req.writeVersion());
             tx.invalidate(req.isInvalidate());
-            tx.mvccCoordinatorVersion(req.mvccCoordinatorVersion());
+            tx.mvccInfo(req.mvccInfo());
 
             // Complete remote candidates.
             tx.doneRemote(req.version(), null, null, null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3888d69c/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 ab70e95..0081ec2 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
@@ -518,7 +518,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
             try {
                 cctx.tm().txContext(this);
 
-                assert !txState.mvccEnabled(cctx) || mvccVer != null;
+                assert !txState.mvccEnabled(cctx) || mvccInfo != null;
 
                 AffinityTopologyVersion topVer = topologyVersion();
 
@@ -698,7 +698,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
                                             resolveTaskName(),
                                             dhtVer,
                                             null,
-                                            mvccVer);
+                                            mvccInfo != null ? mvccInfo.version() : null);
 
                                         if (updRes.success()) {
                                             txEntry.updateCounter(updRes.updatePartitionCounter());
@@ -736,7 +736,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
                                                 resolveTaskName(),
                                                 dhtVer,
                                                 null,
-                                                mvccVer);
+                                                mvccInfo != null ? mvccInfo.version() : null);
                                         }
                                     }
                                     else if (op == DELETE) {
@@ -758,7 +758,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
                                             resolveTaskName(),
                                             dhtVer,
                                             null,
-                                            mvccVer);
+                                            mvccInfo != null ? mvccInfo.version() : null);
 
                                         if (updRes.success())
                                             txEntry.updateCounter(updRes.updatePartitionCounter());
@@ -782,7 +782,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
                                                 resolveTaskName(),
                                                 dhtVer,
                                                 null,
-                                                mvccVer);
+                                                mvccInfo != null ? mvccInfo.version() : null);
                                         }
                                     }
                                     else if (op == RELOAD) {


[02/17] ignite git commit: IGNITE-5732 Provide API to test compatibility with old releases

Posted by sb...@apache.org.
IGNITE-5732 Provide API to test compatibility with old releases


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

Branch: refs/heads/ignite-3479
Commit: c6571448c5d75af3093436323f9f339602a5c083
Parents: 1f2f872
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Fri Sep 22 14:10:37 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 22 14:10:37 2017 +0300

----------------------------------------------------------------------
 modules/compatibility/README.txt                |   5 +
 modules/compatibility/licenses/apache-2.0.txt   | 202 +++++++++++++
 modules/compatibility/pom.xml                   |  94 +++++++
 .../ignite/compatibility/package-info.java      |  22 ++
 .../DummyPersistenceCompatibilityTest.java      | 108 +++++++
 ...itePersistenceCompatibilityAbstractTest.java |  89 ++++++
 .../compatibility/persistence/package-info.java |  22 ++
 .../junits/CompatibilityTestsFacade.java        |  46 +++
 .../junits/IgniteCompatibilityAbstractTest.java | 280 +++++++++++++++++++
 .../junits/IgniteCompatibilityNodeRunner.java   | 157 +++++++++++
 .../logger/ListenedGridTestLog4jLogger.java     |  91 ++++++
 .../junits/logger/package-info.java             |  22 ++
 .../testframework/junits/package-info.java      |  22 ++
 .../testframework/package-info.java             |  22 ++
 .../plugins/DisabledValidationProcessor.java    |  42 +++
 .../TestCompatibilityPluginProvider.java        | 119 ++++++++
 .../testframework/plugins/package-info.java     |  22 ++
 .../testframework/util/MavenUtils.java          | 208 ++++++++++++++
 .../testframework/util/package-info.java        |  22 ++
 .../IgniteCompatibilityBasicTestSuite.java      |  38 +++
 .../compatibility/testsuites/package-info.java  |  22 ++
 .../org.apache.ignite.plugin.PluginProvider     |   1 +
 .../org.apache.ignite.plugin.PluginProvider     |   2 +-
 .../junits/multijvm/IgniteNodeRunner.java       |   2 +-
 .../junits/multijvm/IgniteProcessProxy.java     |  90 ++++--
 pom.xml                                         |   8 +
 26 files changed, 1734 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/README.txt
----------------------------------------------------------------------
diff --git a/modules/compatibility/README.txt b/modules/compatibility/README.txt
new file mode 100644
index 0000000..f2743ec
--- /dev/null
+++ b/modules/compatibility/README.txt
@@ -0,0 +1,5 @@
+Apache Ignite Compatibility Tests
+------------------------
+
+Special module contains testing framework which provides methods for testing backward compatibility.
+It allows to start Ignite-cluster in multiversion mode. It means that nodes with different build version is allowed to join topology.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/compatibility/licenses/apache-2.0.txt b/modules/compatibility/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/compatibility/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/pom.xml
----------------------------------------------------------------------
diff --git a/modules/compatibility/pom.xml b/modules/compatibility/pom.xml
new file mode 100644
index 0000000..166848d
--- /dev/null
+++ b/modules/compatibility/pom.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-compatibility</artifactId>
+    <version>2.3.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>${guava.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.8</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/package-info.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/package-info.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/package-info.java
new file mode 100644
index 0000000..73d9423
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains compatibility tests or compatibility test related classes and interfaces.
+ */
+package org.apache.ignite.compatibility;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
new file mode 100644
index 0000000..f548939
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.compatibility.persistence;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.GridCacheAbstractFullApiSelfTest;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+
+/** */
+public class DummyPersistenceCompatibilityTest extends IgnitePersistenceCompatibilityAbstractTest {
+    /** */
+    private static final String TEST_CACHE_NAME = DummyPersistenceCompatibilityTest.class.getSimpleName();
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setPeerClassLoadingEnabled(false);
+
+        cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNodeStartByOldVersionPersistenceData() throws Exception {
+        try {
+            startGrid(1, "2.2.0", new ConfigurationClosure(), new PostStartupClosure());
+
+            stopAllGrids();
+
+            IgniteEx ignite = startGrid(0);
+
+            assertEquals(1, ignite.context().discovery().topologyVersion());
+
+            ignite.active(true);
+
+            IgniteCache<Integer, String> cache = ignite.getOrCreateCache(TEST_CACHE_NAME);
+
+            for (int i = 0; i < 10; i++)
+                assertEquals("data" + i, cache.get(i));
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /** */
+    private static class PostStartupClosure implements IgniteInClosure<Ignite> {
+        /** {@inheritDoc} */
+        @Override public void apply(Ignite ignite) {
+            ignite.active(true);
+
+            CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
+            cacheCfg.setName(TEST_CACHE_NAME);
+            cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+            cacheCfg.setBackups(1);
+            cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+
+            IgniteCache<Integer, String> cache = ignite.createCache(cacheCfg);
+
+            for (int i = 0; i < 10; i++)
+                cache.put(i, "data" + i);
+        }
+    }
+
+    /** */
+    private static class ConfigurationClosure implements IgniteInClosure<IgniteConfiguration> {
+        /** {@inheritDoc} */
+        @Override public void apply(IgniteConfiguration cfg) {
+            cfg.setLocalHost("127.0.0.1");
+
+            TcpDiscoverySpi disco = new TcpDiscoverySpi();
+            disco.setIpFinder(GridCacheAbstractFullApiSelfTest.LOCAL_IP_FINDER);
+
+            cfg.setDiscoverySpi(disco);
+
+            cfg.setPeerClassLoadingEnabled(false);
+
+            cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java
new file mode 100644
index 0000000..6eb49e4
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.compatibility.persistence;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.compatibility.testframework.junits.IgniteCompatibilityAbstractTest;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Super class for all persistence compatibility tests.
+ */
+public class IgnitePersistenceCompatibilityAbstractTest extends IgniteCompatibilityAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        if (!isDefaultDBWorkDirectoryEmpty())
+            deleteDefaultDBWorkDirectory();
+
+        assert isDefaultDBWorkDirectoryEmpty() : "DB work directory is not empty.";
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        assert deleteDefaultDBWorkDirectory() : "Couldn't delete DB work directory.";
+    }
+
+    /**
+     * Gets a path to the default DB working directory.
+     *
+     * @return Path to the default DB working directory.
+     * @throws IgniteCheckedException In case of an error.
+     * @see #deleteDefaultDBWorkDirectory()
+     * @see #isDefaultDBWorkDirectoryEmpty()
+     */
+    protected Path getDefaultDbWorkPath() throws IgniteCheckedException {
+        return Paths.get(U.defaultWorkDirectory() + File.separator + "db");
+    }
+
+    /**
+     * Deletes the default DB working directory with all sub-directories and files.
+     *
+     * @return {@code true} if and only if the file or directory is successfully deleted, otherwise {@code false}.
+     * @throws IgniteCheckedException In case of an error.
+     * @see #getDefaultDbWorkPath()
+     * @see #deleteDefaultDBWorkDirectory()
+     */
+    protected boolean deleteDefaultDBWorkDirectory() throws IgniteCheckedException {
+        Path dir = getDefaultDbWorkPath();
+
+        return Files.notExists(dir) || U.delete(dir.toFile());
+    }
+
+    /**
+     * Checks if the default DB working directory is empty.
+     *
+     * @return {@code true} if the default DB working directory is empty or doesn't exist, otherwise {@code false}.
+     * @throws IgniteCheckedException In case of an error.
+     * @see #getDefaultDbWorkPath()
+     * @see #deleteDefaultDBWorkDirectory()
+     */
+    @SuppressWarnings("ConstantConditions")
+    protected boolean isDefaultDBWorkDirectoryEmpty() throws IgniteCheckedException {
+        File dir = getDefaultDbWorkPath().toFile();
+
+        return !dir.exists() || (dir.isDirectory() && dir.list().length == 0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/package-info.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/package-info.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/package-info.java
new file mode 100644
index 0000000..027919f
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains compatibility test framework related classes and interfaces.
+ */
+package org.apache.ignite.compatibility.persistence;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/CompatibilityTestsFacade.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/CompatibilityTestsFacade.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/CompatibilityTestsFacade.java
new file mode 100644
index 0000000..6049314
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/CompatibilityTestsFacade.java
@@ -0,0 +1,46 @@
+/*
+ * 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.compatibility.testframework.junits;
+
+import org.apache.ignite.configuration.IgniteConfiguration;
+
+/**
+ * Provides useful methods for compatibility tests.
+ */
+public class CompatibilityTestsFacade {
+    /** */
+    private static final TestsMethodsFacade DELEGATE = new TestsMethodsFacade();
+
+    /**
+     * Gets default tests configuration.
+     *
+     * @return Default tests Ignite configuration.
+     * @throws Exception In case of an error.
+     */
+    public static IgniteConfiguration getConfiguration() throws Exception {
+        return DELEGATE.getConfiguration();
+    }
+
+    /** */
+    private static class TestsMethodsFacade extends IgniteCompatibilityAbstractTest {
+        /** {@inheritDoc} */
+        @Override public IgniteConfiguration getConfiguration() throws Exception {
+            return super.getConfiguration();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
new file mode 100644
index 0000000..728227a
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
@@ -0,0 +1,280 @@
+/*
+ * 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.compatibility.testframework.junits;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.compatibility.testframework.junits.logger.ListenedGridTestLog4jLogger;
+import org.apache.ignite.compatibility.testframework.util.MavenUtils;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Super class for all compatibility tests.
+ */
+public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstractTest {
+    /** Using for synchronization of nodes startup in case of starting remote nodes first. */
+    public static final String SYNCHRONIZATION_LOG_MESSAGE_PREPARED = "[Compatibility] Node has been started, id=";
+
+    /** Waiting milliseconds of the join of a node to topology. */
+    protected static final int NODE_JOIN_TIMEOUT = 30_000;
+
+    /** Local JVM Ignite node. */
+    protected Ignite locJvmInstance = null;
+
+    /** Remote JVM Ignite instance. */
+    protected Ignite rmJvmInstance = null;
+
+    /** {@inheritDoc} */
+    @Override protected boolean isMultiJvm() {
+        return true;
+    }
+
+    /**
+     * Starts new Ignite instance of given version and index <b>in separate JVM</b>.
+     *
+     * Uses an ignite-core artifact in the Maven local repository, if it isn't exists there, it will be downloaded and
+     * stored via Maven.
+     *
+     * @param idx Index of the grid to start.
+     * @param ver Ignite version.
+     * @param cfgClo IgniteInClosure for post-configuration.
+     * @return Started grid.
+     * @throws Exception If failed.
+     */
+    protected IgniteEx startGrid(int idx, String ver, IgniteInClosure<IgniteConfiguration> cfgClo) throws Exception {
+        return startGrid(getTestIgniteInstanceName(idx), ver, cfgClo, null);
+    }
+
+    /**
+     * Starts new Ignite instance of given version and name <b>in separate JVM</b>.
+     *
+     * Uses an ignite-core artifact in the Maven local repository, if it isn't exists there, it will be downloaded and
+     * stored via Maven.
+     *
+     * @param igniteInstanceName Instance name.
+     * @param ver Ignite version.
+     * @param cfgClo IgniteInClosure for post-configuration.
+     * @return Started grid.
+     * @throws Exception If failed.
+     */
+    protected IgniteEx startGrid(String igniteInstanceName, String ver,
+        IgniteInClosure<IgniteConfiguration> cfgClo) throws Exception {
+        return startGrid(igniteInstanceName, ver, cfgClo, null);
+    }
+
+    /**
+     * Starts new Ignite instance of given version and index <b>in separate JVM</b>.
+     *
+     * Uses an ignite-core artifact in the Maven local repository, if it isn't exists there, it will be downloaded and
+     * stored via Maven.
+     *
+     * @param idx Index of the grid to start.
+     * @param ver Ignite version.
+     * @param cfgClo IgniteInClosure for post-configuration.
+     * @param clo IgniteInClosure for actions on started Ignite.
+     * @return Started grid.
+     * @throws Exception In case of an error.
+     */
+    protected IgniteEx startGrid(int idx, final String ver,
+        IgniteInClosure<IgniteConfiguration> cfgClo, IgniteInClosure<Ignite> clo) throws Exception {
+        return startGrid(getTestIgniteInstanceName(idx), ver, cfgClo, clo);
+    }
+
+    /**
+     * Starts new Ignite instance of given version and name <b>in separate JVM</b>.
+     *
+     * Uses an ignite-core artifact in the Maven local repository, if it isn't exists there, it will be downloaded and
+     * stored via Maven.
+     *
+     * @param igniteInstanceName Instance name.
+     * @param ver Ignite version.
+     * @param cfgClo IgniteInClosure for post-configuration.
+     * @param clo IgniteInClosure for actions on started Ignite.
+     * @return Started grid.
+     * @throws Exception In case of an error.
+     */
+    protected IgniteEx startGrid(final String igniteInstanceName, final String ver,
+        IgniteInClosure<IgniteConfiguration> cfgClo, IgniteInClosure<Ignite> clo) throws Exception {
+        assert isMultiJvm() : "MultiJvm mode must be switched on for the node stop properly.";
+
+        assert !igniteInstanceName.equals(getTestIgniteInstanceName(0)) : "Use default instance name for local nodes only.";
+
+        final String cfgCloPath = IgniteCompatibilityNodeRunner.storeToFile(cfgClo);
+        final String cloPath = IgniteCompatibilityNodeRunner.storeToFile(clo);
+
+        final IgniteConfiguration cfg = getConfiguration(igniteInstanceName); // stub - won't be used at node startup
+
+        IgniteProcessProxy ignite = new IgniteProcessProxy(cfg, log, locJvmInstance, true) {
+            @Override protected IgniteLogger logger(IgniteLogger log, Object ctgr) {
+                return ListenedGridTestLog4jLogger.createLogger(ctgr);
+            }
+
+            @Override protected String igniteNodeRunnerClassName() throws Exception {
+                return IgniteCompatibilityNodeRunner.class.getCanonicalName();
+            }
+
+            @Override protected String params(IgniteConfiguration cfg, boolean resetDiscovery) throws Exception {
+                return cfgCloPath + " " + igniteInstanceName + " "
+                    + getId() + " "
+                    + (rmJvmInstance == null ? getId() : ((IgniteProcessProxy)rmJvmInstance).getId())
+                    + (cloPath == null ? "" : " " + cloPath);
+            }
+
+            @Override protected Collection<String> filteredJvmArgs() throws Exception {
+                Collection<String> filteredJvmArgs = new ArrayList<>();
+
+                filteredJvmArgs.add("-ea");
+
+                for (String arg : U.jvmArgs()) {
+                    if (arg.startsWith("-Xmx") || arg.startsWith("-Xms"))
+                        filteredJvmArgs.add(arg);
+                }
+
+                String classPath = System.getProperty("java.class.path");
+
+                String[] paths = classPath.split(File.pathSeparator);
+
+                StringBuilder pathBuilder = new StringBuilder();
+
+                String corePathTemplate = "ignite.modules.core.target.classes".replace(".", File.separator);
+                String coreTestsPathTemplate = "ignite.modules.core.target.test-classes".replace(".", File.separator);
+
+                for (String path : paths) {
+                    if (!path.contains(corePathTemplate) && !path.contains(coreTestsPathTemplate))
+                        pathBuilder.append(path).append(File.pathSeparator);
+                }
+
+                String pathToArtifact = MavenUtils.getPathToIgniteCoreArtifact(ver);
+
+                pathBuilder.append(pathToArtifact).append(File.pathSeparator);
+
+                String pathToTestsArtifact = MavenUtils.getPathToIgniteCoreArtifact(ver, "tests");
+
+                pathBuilder.append(pathToTestsArtifact).append(File.pathSeparator);
+
+                filteredJvmArgs.add("-cp");
+                filteredJvmArgs.add(pathBuilder.toString());
+
+                return filteredJvmArgs;
+            }
+        };
+
+        if (locJvmInstance == null) {
+            CountDownLatch nodeJoinedLatch = new CountDownLatch(1);
+
+            UUID nodeId = ignite.getId();
+
+            ListenedGridTestLog4jLogger log = (ListenedGridTestLog4jLogger)ignite.log();
+
+            log.addListener(nodeId, new LoggedJoinNodeClosure(nodeJoinedLatch, nodeId));
+
+            assert nodeJoinedLatch.await(NODE_JOIN_TIMEOUT, TimeUnit.MILLISECONDS) : "Node has not joined [id=" + nodeId + "]";
+
+            log.removeListener(nodeId);
+        }
+
+        if (rmJvmInstance == null)
+            rmJvmInstance = ignite;
+
+        return ignite;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Ignite startGrid(String igniteInstanceName, IgniteConfiguration cfg,
+        GridSpringResourceContext ctx) throws Exception {
+        final Ignite ignite;
+
+        // if started node isn't first node in the local JVM then it was checked earlier for join to topology
+        // in IgniteProcessProxy constructor.
+        if (locJvmInstance == null && rmJvmInstance != null) {
+            final UUID nodeId = cfg.getNodeId();
+            final UUID syncNodeId = ((IgniteProcessProxy)rmJvmInstance).getId();
+
+            ignite = super.startGrid(igniteInstanceName, cfg, ctx);
+
+            assert ignite.configuration().getNodeId() == nodeId : "Started node has unexpected node id.";
+
+            assert ignite.cluster().node(syncNodeId) != null : "Node has not joined [id=" + nodeId + "]";
+        }
+        else
+            ignite = super.startGrid(igniteInstanceName, cfg, ctx);
+
+        if (locJvmInstance == null && !isRemoteJvm(igniteInstanceName))
+            locJvmInstance = ignite;
+
+        return ignite;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void stopGrid(@Nullable String igniteInstanceName, boolean cancel, boolean awaitTop) {
+        if (isRemoteJvm(igniteInstanceName))
+            throw new UnsupportedOperationException("Operation isn't supported yet for remotes nodes, use stopAllGrids() instead.");
+        else {
+            super.stopGrid(igniteInstanceName, cancel, awaitTop);
+
+            locJvmInstance = null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void stopAllGrids(boolean cancel) {
+        locJvmInstance = null;
+        rmJvmInstance = null;
+
+        super.stopAllGrids(cancel);
+    }
+
+    /** */
+    protected static class LoggedJoinNodeClosure implements IgniteInClosure<String> {
+        /** Node joined latch. */
+        private CountDownLatch nodeJoinedLatch;
+
+        /** Pattern for comparing. */
+        private String pattern;
+
+        /**
+         * @param nodeJoinedLatch Nodes startup synchronization latch.
+         * @param nodeId Expected node id.
+         */
+        LoggedJoinNodeClosure(CountDownLatch nodeJoinedLatch, UUID nodeId) {
+            this.nodeJoinedLatch = nodeJoinedLatch;
+            this.pattern = SYNCHRONIZATION_LOG_MESSAGE_PREPARED + nodeId;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void apply(String s) {
+            if (nodeJoinedLatch.getCount() > 0 && s.contains(pattern))
+                nodeJoinedLatch.countDown();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
new file mode 100644
index 0000000..3256d06
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
@@ -0,0 +1,157 @@
+/*
+ * 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.compatibility.testframework.junits;
+
+import com.thoughtworks.xstream.XStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.GridJavaProcess;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.multijvm.IgniteNodeRunner;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Runs Ignite node.
+ */
+public class IgniteCompatibilityNodeRunner extends IgniteNodeRunner {
+    /** */
+    private static final String IGNITE_COMPATIBILITY_CLOSURE_FILE = System.getProperty("java.io.tmpdir") +
+        File.separator + "igniteCompatibilityClosure.tmp_";
+
+    /**
+     * Starts {@link Ignite} with test's default configuration.
+     *
+     * Command-line arguments specification:
+     * <pre>
+     * args[0] - required - path to closure for tuning IgniteConfiguration before node startup;
+     * args[1] - required - name of the starting node;
+     * args[2] - required - id of the starting node;
+     * args[3] - required - sync-id of a node for synchronization of startup. Must be equals
+     * to arg[2] in case of starting the first node in the Ignite cluster;
+     * args[4] - optional - path to closure for actions after node startup.
+     * </pre>
+     *
+     * @param args Command-line arguments.
+     * @throws Exception In case of an error.
+     */
+    public static void main(String[] args) throws Exception {
+        X.println(GridJavaProcess.PID_MSG_PREFIX + U.jvmPid());
+
+        X.println("Starting Ignite Node... Args=" + Arrays.toString(args));
+
+        if (args.length < 3) {
+            throw new IllegalArgumentException("At least four arguments expected:" +
+                " [path/to/closure/file] [ignite-instance-name] [node-id] [sync-node-id] [optional/path/to/closure/file]");
+        }
+
+        IgniteConfiguration cfg = CompatibilityTestsFacade.getConfiguration();
+
+        IgniteInClosure<IgniteConfiguration> cfgClo = readClosureFromFileAndDelete(args[0]);
+
+        cfgClo.apply(cfg);
+
+        final UUID nodeId = UUID.fromString(args[2]);
+        final UUID syncNodeId = UUID.fromString(args[3]);
+
+        // Ignite instance name and id must be set according to arguments
+        // it's used for nodes managing: start, stop etc.
+        cfg.setIgniteInstanceName(args[1]);
+        cfg.setNodeId(nodeId);
+
+        final Ignite ignite = Ignition.start(cfg);
+
+        assert ignite.cluster().node(syncNodeId) != null : "Node has not joined [id=" + nodeId + "]";
+
+        // It needs to set private static field 'ignite' of the IgniteNodeRunner class via reflection
+        GridTestUtils.setFieldValue(new IgniteNodeRunner(), "ignite", ignite);
+
+        if (args.length == 5) {
+            IgniteInClosure<Ignite> clo = readClosureFromFileAndDelete(args[4]);
+
+            clo.apply(ignite);
+        }
+
+        X.println(IgniteCompatibilityAbstractTest.SYNCHRONIZATION_LOG_MESSAGE_PREPARED + nodeId);
+    }
+
+    /**
+     * Stores {@link IgniteInClosure} to file as xml.
+     *
+     * @param clo IgniteInClosure.
+     * @return A name of file where the closure was stored.
+     * @throws IOException In case of an error.
+     * @see #readClosureFromFileAndDelete(String)
+     */
+    @Nullable public static String storeToFile(@Nullable IgniteInClosure clo) throws IOException {
+        if (clo == null)
+            return null;
+
+        String fileName = IGNITE_COMPATIBILITY_CLOSURE_FILE + clo.hashCode();
+
+        storeToFile(clo, fileName);
+
+        return fileName;
+    }
+
+    /**
+     * Stores {@link IgniteInClosure} to file as xml.
+     *
+     * @param clo IgniteInClosure.
+     * @param fileName A name of file where the closure was stored.
+     * @throws IOException In case of an error.
+     * @see #readClosureFromFileAndDelete(String)
+     */
+    public static void storeToFile(@NotNull IgniteInClosure clo, @NotNull String fileName) throws IOException {
+        try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(fileName), StandardCharsets.UTF_8)) {
+            new XStream().toXML(clo, writer);
+        }
+    }
+
+    /**
+     * Reads closure from given file name and delete the file after.
+     *
+     * @param fileName Closure file name.
+     * @param <T> Type of closure argument.
+     * @return IgniteInClosure for post-configuration.
+     * @throws IOException In case of an error.
+     * @see #storeToFile(IgniteInClosure, String)
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> IgniteInClosure<T> readClosureFromFileAndDelete(String fileName) throws IOException {
+        try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), StandardCharsets.UTF_8)) {
+            return (IgniteInClosure<T>)new XStream().fromXML(reader);
+        }
+        finally {
+            U.delete(new File(fileName));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/logger/ListenedGridTestLog4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/logger/ListenedGridTestLog4jLogger.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/logger/ListenedGridTestLog4jLogger.java
new file mode 100644
index 0000000..f95e174
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/logger/ListenedGridTestLog4jLogger.java
@@ -0,0 +1,91 @@
+/*
+ * 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.compatibility.testframework.junits.logger;
+
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
+import org.apache.log4j.Logger;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Listened version of {@link GridTestLog4jLogger} logger. Provides methods of registering and notifying listeners.
+ */
+public class ListenedGridTestLog4jLogger extends GridTestLog4jLogger {
+    /** Listeners. */
+    private final ConcurrentMap<UUID, IgniteInClosure<String>> lsnrs = new ConcurrentHashMap<>();
+
+    /** {@inheritDoc} */
+    public ListenedGridTestLog4jLogger(Logger impl) {
+        super(impl);
+    }
+
+    /**
+     * Creates new logger instance with given category.
+     *
+     * @param ctgr Category.
+     * @return Initiated logger.
+     */
+    public static GridTestLog4jLogger createLogger(Object ctgr) {
+        return new ListenedGridTestLog4jLogger(ctgr == null ? Logger.getRootLogger() :
+            ctgr instanceof Class ? Logger.getLogger(((Class<?>)ctgr).getName()) :
+                Logger.getLogger(ctgr.toString()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void info(String msg) {
+        notifyListeners(msg);
+
+        super.info(msg);
+    }
+
+    /**
+     * Notifies registered listeners.
+     *
+     * @param msg Message.
+     */
+    protected void notifyListeners(String msg) {
+        for (IgniteInClosure<String> lsnr : lsnrs.values())
+            lsnr.apply(msg);
+    }
+
+    /**
+     * Adds listener.
+     *
+     * @param key Key.
+     * @param lsnr Listener.
+     * @return The previous value associated with the specified key, or {@code null} if there was no mapping for the key.
+     */
+    @Nullable public IgniteInClosure<String> addListener(@NotNull UUID key, @NotNull IgniteInClosure<String> lsnr) {
+        return lsnrs.putIfAbsent(key, lsnr);
+    }
+
+    /**
+     * Removes listeners.
+     *
+     * @param key Key.
+     * @return Returns the value to which this map previously associated the key, or {@code null} if the map contained no
+     * mapping for the key.
+     */
+    @Nullable public IgniteInClosure<String> removeListener(@NotNull UUID key) {
+        return lsnrs.remove(key);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/logger/package-info.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/logger/package-info.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/logger/package-info.java
new file mode 100644
index 0000000..64892d8
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/logger/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains compatibility test framework related classes and interfaces.
+ */
+package org.apache.ignite.compatibility.testframework.junits.logger;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/package-info.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/package-info.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/package-info.java
new file mode 100644
index 0000000..996729f
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains compatibility test framework related classes and interfaces.
+ */
+package org.apache.ignite.compatibility.testframework.junits;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/package-info.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/package-info.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/package-info.java
new file mode 100644
index 0000000..81ec1b6
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains compatibility test framework related classes and interfaces.
+ */
+package org.apache.ignite.compatibility.testframework;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/DisabledValidationProcessor.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/DisabledValidationProcessor.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/DisabledValidationProcessor.java
new file mode 100644
index 0000000..8c88f4f
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/DisabledValidationProcessor.java
@@ -0,0 +1,42 @@
+/*
+ * 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.compatibility.testframework.plugins;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.GridProcessorAdapter;
+import org.apache.ignite.internal.processors.nodevalidation.DiscoveryNodeValidationProcessor;
+import org.apache.ignite.spi.IgniteNodeValidationResult;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Disabled node validation.
+ */
+public class DisabledValidationProcessor extends GridProcessorAdapter implements DiscoveryNodeValidationProcessor {
+    /**
+     * @param ctx Kernal context.
+     */
+    public DisabledValidationProcessor(GridKernalContext ctx) {
+        super(ctx);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public IgniteNodeValidationResult validateNode(ClusterNode node) {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/TestCompatibilityPluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/TestCompatibilityPluginProvider.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/TestCompatibilityPluginProvider.java
new file mode 100644
index 0000000..3a42811
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/TestCompatibilityPluginProvider.java
@@ -0,0 +1,119 @@
+/*
+ * 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.compatibility.testframework.plugins;
+
+import java.io.Serializable;
+import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.IgniteNodeAttributes;
+import org.apache.ignite.internal.processors.nodevalidation.DiscoveryNodeValidationProcessor;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Creates {@link DisabledValidationProcessor} to allow for nodes with different
+ * versions {@link IgniteNodeAttributes#ATTR_BUILD_VER} join to topology.
+ */
+public class TestCompatibilityPluginProvider implements PluginProvider {
+    /** */
+    private GridKernalContext kCtx;
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "TestCompatibilityPlugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) throws IgniteCheckedException {
+        kCtx = ((IgniteKernal)ctx.grid()).context();
+    }
+
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext ctx) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext ctx) throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean cancel) throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStop(boolean cancel) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Serializable provideDiscoveryData(UUID nodeId) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void receiveDiscoveryData(UUID nodeId, Serializable data) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void validateNewNode(ClusterNode node) throws PluginValidationException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object createComponent(PluginContext ctx, Class cls) {
+        if (DiscoveryNodeValidationProcessor.class == cls)
+            return new DisabledValidationProcessor(kCtx);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgnitePlugin plugin() {
+        return new IgnitePlugin() {
+            // No-op.
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/package-info.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/package-info.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/package-info.java
new file mode 100644
index 0000000..05ba5c2
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains compatibility test framework related classes and interfaces.
+ */
+package org.apache.ignite.compatibility.testframework.plugins;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/MavenUtils.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/MavenUtils.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/MavenUtils.java
new file mode 100644
index 0000000..fe73e48
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/MavenUtils.java
@@ -0,0 +1,208 @@
+/*
+ * 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.compatibility.testframework.util;
+
+import com.google.common.base.Charsets;
+import com.google.common.io.CharStreams;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Provides some useful methods to work with Maven.
+ */
+public class MavenUtils {
+    /** Path to Maven local repository. For caching. */
+    private static String locRepPath = null;
+
+    /**
+     * Gets a path to an artifact with given version and groupId=org.apache.ignite and artifactId=ignite-core.
+     *
+     * At first, artifact is looked for in the Maven local repository, if it isn't exists there, it will be downloaded
+     * and stored via Maven.
+     *
+     * @param ver Version of ignite-core artifact.
+     * @return Path to the artifact.
+     * @throws Exception In case of an error.
+     * @see #getPathToArtifact(String)
+     */
+    public static String getPathToIgniteCoreArtifact(@NotNull String ver) throws Exception {
+        return getPathToIgniteCoreArtifact(ver, null);
+    }
+
+    /**
+     * Gets a path to an artifact with given version and groupId=org.apache.ignite and artifactId=ignite-core.
+     *
+     * At first, artifact is looked for in the Maven local repository, if it isn't exists there, it will be downloaded
+     * and stored via Maven.
+     *
+     * @param ver Version of ignite-core artifact.
+     * @param classifier Artifact classifier.
+     * @return Path to the artifact.
+     * @throws Exception In case of an error.
+     * @see #getPathToArtifact(String)
+     */
+    public static String getPathToIgniteCoreArtifact(@NotNull String ver,
+        @Nullable String classifier) throws Exception {
+        String artifact = "org.apache.ignite:ignite-core:" + ver;
+
+        if (classifier != null)
+            artifact += ":jar:" + classifier;
+
+        return getPathToArtifact(artifact);
+    }
+
+    /**
+     * Gets a path to an artifact with given identifier.
+     *
+     * At first, artifact is looked for in the Maven local repository, if it isn't exists there, it will be downloaded
+     * and stored via Maven.
+     *
+     * @param artifact Artifact identifier, must match pattern [groupId:artifactId:version[:packaging[:classifier]]].
+     * @return Path to the artifact.
+     * @throws Exception In case of an error.
+     */
+    public static String getPathToArtifact(@NotNull String artifact) throws Exception {
+        String[] names = artifact.split(":");
+
+        assert names.length >= 3;
+
+        String groupId = names[0];
+        String artifactId = names[1];
+        String version = names[2];
+        String packaging = names.length > 3 ? names[3] : null;
+        String classifier = names.length > 4 ? names[4] : null;
+
+        String jarFileName = String.format("%s-%s%s.%s",
+            artifactId,
+            version,
+            (classifier == null ? "" : "-" + classifier),
+            (packaging == null ? "jar" : packaging)
+        );
+
+        String pathToArtifact = getMavenLocalRepositoryPath() + File.separator +
+            groupId.replace(".", File.separator) + File.separator +
+            artifactId.replace(".", File.separator) + File.separator +
+            version + File.separator + jarFileName;
+
+        if (Files.notExists(Paths.get(pathToArtifact)))
+            downloadArtifact(artifact);
+
+        return pathToArtifact;
+    }
+
+    /**
+     * Gets a path to the Maven local repository.
+     *
+     * @return Path to the Maven local repository.
+     * @throws Exception In case of an error.
+     */
+    public static String getMavenLocalRepositoryPath() throws Exception {
+        if (locRepPath == null)
+            locRepPath = defineMavenLocalRepositoryPath();
+
+        return locRepPath;
+    }
+
+    /**
+     * Defines a path to the Maven local repository.
+     *
+     * @return Path to the Maven local repository.
+     * @throws Exception In case of an error.
+     */
+    private static String defineMavenLocalRepositoryPath() throws Exception {
+        String output = exec("mvn help:effective-settings");
+
+        int endTagPos = output.indexOf("</localRepository>");
+
+        assert endTagPos >= 0 : "Couldn't define path to Maven local repository";
+
+        return output.substring(output.lastIndexOf(">", endTagPos) + 1, endTagPos);
+    }
+
+    /**
+     * Downloads and stores in local repository an artifact with given identifier.
+     *
+     * @param artifact Artifact identifier, must match pattern [groupId:artifactId:version].
+     * @throws Exception In case of an error.
+     */
+    private static void downloadArtifact(String artifact) throws Exception {
+        X.println("Downloading artifact... Identifier: " + artifact);
+
+        exec("mvn dependency:get -Dartifact=" + artifact);
+
+        X.println("Download is finished");
+    }
+
+    /**
+     * Executes given command in operation system.
+     *
+     * @param cmd Command to execute.
+     * @return Output of result of executed command.
+     * @throws Exception In case of an error.
+     */
+    private static String exec(String cmd) throws Exception {
+        ProcessBuilder pb = new ProcessBuilder();
+        pb.redirectErrorStream(true);
+
+        pb.command(U.isWindows() ?
+            new String[] {"cmd", "/c", cmd} :
+            new String[] {"/bin/bash", "-c", cmd});
+
+        final Process p = pb.start();
+
+        Future<String> fut = Executors.newSingleThreadExecutor().submit(new Callable<String>() {
+            @Override public String call() throws Exception {
+                String output = CharStreams.toString(new InputStreamReader(p.getInputStream(), Charsets.UTF_8));
+
+                p.waitFor();
+
+                return output;
+            }
+        });
+
+        String output = null;
+
+        try {
+            output = fut.get(5, TimeUnit.MINUTES);
+
+            int exitVal = p.exitValue();
+
+            if (exitVal != 0)
+                throw new Exception(String.format("Abnormal exit value of %s for pid %s", exitVal, U.jvmPid()));
+
+            return output;
+        }
+        catch (Exception e) {
+            p.destroy();
+
+            X.printerrln("Command='" + cmd + "' couldn't be executed: " + output, Charsets.UTF_8, e);
+
+            throw e;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/package-info.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/package-info.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/package-info.java
new file mode 100644
index 0000000..d3bee94
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains compatibility test framework related classes and interfaces.
+ */
+package org.apache.ignite.compatibility.testframework.util;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java
new file mode 100644
index 0000000..b54b396
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java
@@ -0,0 +1,38 @@
+/*
+ * 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.compatibility.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.compatibility.persistence.DummyPersistenceCompatibilityTest;
+
+/**
+ * Compatibility tests basic test suite.
+ */
+public class IgniteCompatibilityBasicTestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception In case of an error.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Ignite Compatibility Basic Test Suite");
+
+        suite.addTestSuite(DummyPersistenceCompatibilityTest.class);
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/package-info.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/package-info.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/package-info.java
new file mode 100644
index 0000000..5c4efc9
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains test-suites which contains compatibility tests.
+ */
+package org.apache.ignite.compatibility.testsuites;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/compatibility/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider b/modules/compatibility/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
new file mode 100644
index 0000000..d1a8786
--- /dev/null
+++ b/modules/compatibility/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
@@ -0,0 +1 @@
+org.apache.ignite.compatibility.testframework.plugins.TestCompatibilityPluginProvider

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
index 8437ef0..959d444 100644
--- a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
+++ b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
@@ -1,2 +1,2 @@
 org.apache.ignite.spi.discovery.tcp.TestReconnectPluginProvider
-org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteStandByClusterTest$StanByClusterTestProvider
+org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteStandByClusterTest$StanByClusterTestProvider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
index 7d73737..d7be576 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
@@ -56,7 +56,7 @@ public class IgniteNodeRunner {
         File.separator + "igniteConfiguration.tmp_";
 
     /** */
-    private static volatile Ignite ignite;
+    protected static volatile Ignite ignite;
 
     /**
      * Starts {@link Ignite} instance accorging to given arguments.


[04/17] ignite git commit: IGNITE-6484 writeComplete conditional wait is made uninterruptable

Posted by sb...@apache.org.
IGNITE-6484 writeComplete conditional wait is made uninterruptable


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

Branch: refs/heads/ignite-3479
Commit: 54a00fcf1c3544615a66f94b0bb80666e37acbb3
Parents: c219d9b
Author: Alexei Scherbakov <al...@gmail.com>
Authored: Fri Sep 22 16:36:38 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Sep 22 16:36:38 2017 +0300

----------------------------------------------------------------------
 .../cache/persistence/wal/FileWriteAheadLogManager.java     | 4 ++--
 .../java/org/apache/ignite/internal/util/IgniteUtils.java   | 9 +++++++++
 .../db/file/IgnitePdsThreadInterruptionTest.java            | 2 +-
 3 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/54a00fcf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 87069d9..9b2d948 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -1828,7 +1828,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
 
             try {
                 while (written < expWritten && envFailed == null)
-                    U.await(writeComplete);
+                    U.awaitQuiet(writeComplete);
             }
             finally {
                 lock.unlock();
@@ -2163,7 +2163,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
 
             try {
                 while (fileIO != null)
-                    U.await(nextSegment);
+                    U.awaitQuiet(nextSegment);
             }
             finally {
                 lock.unlock();

http://git-wip-us.apache.org/repos/asf/ignite/blob/54a00fcf/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index cbe2cfd..31b556d 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -7398,6 +7398,15 @@ public abstract class IgniteUtils {
     }
 
     /**
+     * Awaits for condition ignoring interrupts.
+     *
+     * @param cond Condition to await for.
+     */
+    public static void awaitQuiet(Condition cond) {
+        cond.awaitUninterruptibly();
+    }
+
+    /**
      * Awaits for condition.
      *
      * @param cond Condition to await for.

http://git-wip-us.apache.org/repos/asf/ignite/blob/54a00fcf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
index aab569a..6f11d4d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
@@ -41,7 +41,7 @@ public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest {
     private static final int PAGE_SIZE = 1 << 12; // 4096
 
     /** */
-    public static final int THREADS_CNT = 1;
+    public static final int THREADS_CNT = 10;
 
     /**
      * Cache name.


[14/17] ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-3478

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

# Conflicts:
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java


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

Branch: refs/heads/ignite-3479
Commit: cc07f9f62e48d2142c22e50ca1952c96c1464683
Parents: 9f0572b
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 26 12:42:53 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 26 12:42:53 2017 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/GridPartitionedGetFuture.java          | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cc07f9f6/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 cd8b8c8..63156fc 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
@@ -155,6 +155,8 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
                 return;
             }
 
+            final AffinityTopologyVersion topVer0 = topVer;
+
             IgniteInternalFuture<MvccCoordinatorVersion> cntrFut = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
 
             cntrFut.listen(new IgniteInClosure<IgniteInternalFuture<MvccCoordinatorVersion>>() {
@@ -164,7 +166,7 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
 
                         map(keys,
                             Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(),
-                            GridPartitionedGetFuture.this.topVer);
+                            topVer0);
 
                         markInitialized();
                     }


[17/17] ignite git commit: ignite-3479

Posted by sb...@apache.org.
ignite-3479


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

Branch: refs/heads/ignite-3479
Commit: 331a255cd117d534f2e25bbc0b0db21c40089ea4
Parents: f3229af
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 26 15:16:10 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 26 17:24:40 2017 +0300

----------------------------------------------------------------------
 .../processors/affinity/AffinityAssignment.java |   9 +-
 .../affinity/GridAffinityAssignment.java        |   7 +-
 .../affinity/GridAffinityAssignmentCache.java   |   5 +-
 .../affinity/HistoryAffinityAssignment.java     |   5 +-
 .../cache/CacheAffinitySharedManager.java       |  12 +-
 .../processors/cache/ExchangeContext.java       |  43 +++++-
 .../cache/GridCacheAffinityManager.java         |   3 +-
 .../dht/GridClientPartitionTopology.java        |   7 +
 .../dht/GridDhtPartitionTopology.java           |   4 +
 .../dht/GridDhtPartitionTopologyImpl.java       |  11 ++
 .../distributed/dht/GridDhtTxPrepareFuture.java |  14 +-
 .../dht/GridPartitionedGetFuture.java           | 145 +++++++++++++++----
 .../GridDhtPartitionsExchangeFuture.java        |  81 +++++++++--
 .../GridDhtPartitionsSingleMessage.java         |  64 ++++++--
 .../GridNearPessimisticTxPrepareFuture.java     |   7 +-
 .../mvcc/CacheCoordinatorsSharedManager.java    |  90 ++++++------
 .../processors/cache/mvcc/MvccCoordinator.java  |  58 ++++++++
 .../processors/cache/mvcc/MvccCounter.java      | 100 +++++++++++++
 .../processors/cache/mvcc/MvccQueryFuture.java  |   3 +-
 .../query/GridCacheDistributedQueryManager.java |   2 +-
 .../cache/query/GridCacheQueryManager.java      |   2 +-
 .../transactions/IgniteTxLocalAdapter.java      |   2 +
 .../util/future/GridCompoundFuture.java         |   4 +-
 .../cache/mvcc/CacheMvccTransactionsTest.java   |  78 +++++++++-
 24 files changed, 619 insertions(+), 137 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java
index acb9213..28dec1c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java
@@ -17,12 +17,12 @@
 
 package org.apache.ignite.internal.processors.affinity;
 
-import org.apache.ignite.cluster.ClusterNode;
-
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.UUID;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 
 /**
  * Cached affinity calculations.
@@ -86,5 +86,8 @@ public interface AffinityAssignment {
      */
     public Set<Integer> backupPartitions(UUID nodeId);
 
-    public ClusterNode mvccCoordinator();
+    /**
+     * @return Mvcc coordinator.
+     */
+    public MvccCoordinator mvccCoordinator();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
index 2913930..a7549cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
@@ -40,7 +41,7 @@ public class GridAffinityAssignment implements AffinityAssignment, Serializable
     private final AffinityTopologyVersion topVer;
 
     /** */
-    private final ClusterNode mvccCrd;
+    private final MvccCoordinator mvccCrd;
 
     /** Collection of calculated affinity nodes. */
     private List<List<ClusterNode>> assignment;
@@ -84,7 +85,7 @@ public class GridAffinityAssignment implements AffinityAssignment, Serializable
     GridAffinityAssignment(AffinityTopologyVersion topVer,
         List<List<ClusterNode>> assignment,
         List<List<ClusterNode>> idealAssignment,
-        ClusterNode mvccCrd) {
+        MvccCoordinator mvccCrd) {
         assert topVer != null;
         assert assignment != null;
         assert idealAssignment != null;
@@ -271,7 +272,7 @@ public class GridAffinityAssignment implements AffinityAssignment, Serializable
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterNode mvccCoordinator() {
+    @Override public MvccCoordinator mvccCoordinator() {
         return mvccCrd;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
index 4b0659c..83837b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.GridNodeOrderComparator;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.managers.discovery.DiscoCache;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -184,7 +185,7 @@ public class GridAffinityAssignmentCache {
      * @param affAssignment Affinity assignment for topology version.
      */
     public void initialize(AffinityTopologyVersion topVer, List<List<ClusterNode>> affAssignment) {
-        ClusterNode mvccCrd = ctx.cache().context().coordinators().currentCoordinatorForCacheAffinity(topVer);
+        MvccCoordinator mvccCrd = ctx.cache().context().coordinators().currentCoordinatorForCacheAffinity(topVer);
 
         initialize(topVer, affAssignment, mvccCrd);
     }
@@ -195,7 +196,7 @@ public class GridAffinityAssignmentCache {
      * @param topVer Topology version.
      * @param affAssignment Affinity assignment for topology version.
      */
-    private void initialize(AffinityTopologyVersion topVer, List<List<ClusterNode>> affAssignment, ClusterNode mvccCrd) {
+    private void initialize(AffinityTopologyVersion topVer, List<List<ClusterNode>> affAssignment, MvccCoordinator mvccCrd) {
         assert topVer.compareTo(lastVersion()) >= 0 : "[topVer = " + topVer + ", last=" + lastVersion() + ']';
         assert idealAssignment != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java
index cae3611..d9c03e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.affinity;
 
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -44,7 +45,7 @@ public class HistoryAffinityAssignment implements AffinityAssignment {
     private final boolean clientEvtChange;
 
     /** */
-    private final ClusterNode mvccCrd;
+    private final MvccCoordinator mvccCrd;
 
     /**
      * @param assign Assignment.
@@ -58,7 +59,7 @@ public class HistoryAffinityAssignment implements AffinityAssignment {
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterNode mvccCoordinator() {
+    @Override public MvccCoordinator mvccCoordinator() {
         return mvccCrd;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 741e204..99727e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -448,7 +448,11 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                         if (grpHolder.client()) {
                             ClientCacheDhtTopologyFuture topFut = new ClientCacheDhtTopologyFuture(topVer);
 
-                            grp.topology().updateTopologyVersion(topFut, discoCache, -1, false);
+                            grp.topology().updateTopologyVersion(topFut,
+                                discoCache,
+                                cctx.coordinators().currentCoordinator(),
+                                -1,
+                                false);
 
                             grpHolder = new CacheGroupHolder1(grp, grpHolder.affinity());
 
@@ -517,7 +521,11 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                         new ClusterTopologyServerNotFoundException("All server nodes left grid."));
                 }
 
-                grp.topology().updateTopologyVersion(topFut, discoCache, -1, false);
+                grp.topology().updateTopologyVersion(topFut,
+                    discoCache,
+                    cctx.coordinators().currentCoordinator(),
+                    -1,
+                    false);
 
                 grp.topology().update(topVer, partMap, null, Collections.<Integer>emptySet(), null);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
index c9f0744..36ce6ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
@@ -18,10 +18,12 @@
 package org.apache.ignite.internal.processors.cache;
 
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCounter;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
@@ -52,21 +54,24 @@ public class ExchangeContext {
     private final boolean compatibilityNode = getBoolean(IGNITE_EXCHANGE_COMPATIBILITY_VER_1, false);
 
     /** */
-    private final boolean mvccCrdChange;
+    private final boolean newMvccCrd;
+
+    /** */
+    private Map<MvccCounter, Integer> activeQrys;
 
     /**
      * @param crd Coordinator flag.
      * @param fut Exchange future.
      */
-    public ExchangeContext(boolean crd, boolean mvccCrdChange, GridDhtPartitionsExchangeFuture fut) {
-        this.mvccCrdChange = mvccCrdChange;
+    public ExchangeContext(boolean crd, boolean newMvccCrd, GridDhtPartitionsExchangeFuture fut) {
+        this.newMvccCrd = newMvccCrd;
 
         int protocolVer = exchangeProtocolVersion(fut.firstEventCache().minimumNodeVersion());
 
         if (compatibilityNode || (crd && fut.localJoinExchange())) {
             fetchAffOnJoin = true;
 
-            merge = !mvccCrdChange;
+            merge = !newMvccCrd;
         }
         else {
             boolean startCaches = fut.exchangeId().isJoined() &&
@@ -74,7 +79,7 @@ public class ExchangeContext {
 
             fetchAffOnJoin = protocolVer == 1;
 
-            merge = !mvccCrdChange &&
+            merge = !newMvccCrd &&
                 !startCaches &&
                 protocolVer > 1 &&
                 fut.firstEvent().type() != EVT_DISCOVERY_CUSTOM_EVT;
@@ -131,10 +136,32 @@ public class ExchangeContext {
     }
 
     /**
-     * @return {@code True} if mvcc coordinator node is changed during this exchange.
+     * @return {@code True} if new node assigned as mvcc coordinator node during this exchange.
      */
-    public boolean mvccCoordinatorChange() {
-        return mvccCrdChange;
+    public boolean newMvccCoordinator() {
+        return newMvccCrd;
+    }
+
+    public Map<MvccCounter, Integer> activeQueries() {
+        return activeQrys;
+    }
+
+    public void addActiveQueries(Map<MvccCounter, Integer> activeQrys0) {
+        if (activeQrys0 == null)
+            return;
+
+        if (activeQrys != null) {
+            for (Map.Entry<MvccCounter, Integer> e : activeQrys0.entrySet()) {
+                Integer cnt = activeQrys.get(e.getKey());
+
+                if (cnt == null)
+                    activeQrys.put(e.getKey(), e.getValue());
+                else
+                    activeQrys.put(e.getKey(), cnt + e.getValue());
+            }
+        }
+        else
+            activeQrys = activeQrys0;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
index a2407e5..91e4505 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.typedef.F;
 import org.jetbrains.annotations.Nullable;
@@ -238,7 +239,7 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter {
         return aff0.cachedAffinity(topVer);
     }
 
-    public ClusterNode mvccCoordinator(AffinityTopologyVersion topVer) {
+    public MvccCoordinator mvccCoordinator(AffinityTopologyVersion topVer) {
         return assignment(topVer).mvccCoordinator();
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/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 e994113..e328c25 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
@@ -45,6 +45,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 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.GridDhtPartitionsExchangeFuture;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridAtomicLong;
 import org.apache.ignite.internal.util.GridPartitionStateMap;
@@ -195,9 +196,15 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
     }
 
     /** {@inheritDoc} */
+    @Override public MvccCoordinator mvccCoordinator() {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
     @Override public void updateTopologyVersion(
         GridDhtTopologyFuture exchFut,
         DiscoCache discoCache,
+        MvccCoordinator mvccCrd,
         long updSeq,
         boolean stopping
     ) throws IgniteInterruptedCheckedException {

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/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 4ae68ef..cf6554a 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
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 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.GridDhtPartitionsExchangeFuture;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.jetbrains.annotations.Nullable;
 
@@ -69,6 +70,7 @@ public interface GridDhtPartitionTopology {
     public void updateTopologyVersion(
         GridDhtTopologyFuture exchFut,
         DiscoCache discoCache,
+        MvccCoordinator mvccCrd,
         long updateSeq,
         boolean stopping
     ) throws IgniteInterruptedCheckedException;
@@ -379,4 +381,6 @@ public interface GridDhtPartitionTopology {
      * @param updateRebalanceVer {@code True} if need check rebalance state.
      */
     public void onExchangeDone(GridDhtPartitionsExchangeFuture fut, AffinityAssignment assignment, boolean updateRebalanceVer);
+
+    public MvccCoordinator mvccCoordinator();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/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 380066a..1f3d00d 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
@@ -49,6 +49,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 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.GridDhtPartitionsExchangeFuture;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridAtomicLong;
 import org.apache.ignite.internal.util.GridPartitionStateMap;
@@ -137,6 +138,9 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
     /** */
     private volatile AffinityTopologyVersion rebalancedTopVer = AffinityTopologyVersion.NONE;
 
+    /** */
+    private volatile MvccCoordinator mvccCrd;
+
     /**
      * @param ctx Cache shared context.
      * @param grp Cache group.
@@ -229,9 +233,15 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
     }
 
     /** {@inheritDoc} */
+    @Override public MvccCoordinator mvccCoordinator() {
+        return mvccCrd;
+    }
+
+    /** {@inheritDoc} */
     @Override public void updateTopologyVersion(
         GridDhtTopologyFuture exchFut,
         DiscoCache discoCache,
+        MvccCoordinator mvccCrd,
         long updSeq,
         boolean stopping
     ) throws IgniteInterruptedCheckedException {
@@ -255,6 +265,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
             lastTopChangeVer = exchTopVer;
 
             this.discoCache = discoCache;
+            this.mvccCrd = mvccCrd;
         }
         finally {
             lock.writeLock().unlock();

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/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 8795007..2af2d51 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
@@ -61,6 +61,7 @@ import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTx
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccResponseListener;
 import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
@@ -259,6 +260,11 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
     }
 
     /** {@inheritDoc} */
+    @Nullable @Override public IgniteLogger logger() {
+        return log;
+    }
+
+    /** {@inheritDoc} */
     @Override public IgniteUuid futureId() {
         return futId;
     }
@@ -1235,14 +1241,16 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             if (req.requestMvccCounter()) {
                 assert tx.txState().mvccEnabled(cctx);
 
-                ClusterNode crd = cctx.coordinators().currentCoordinator();
+                MvccCoordinator crd = cctx.coordinators().currentCoordinator();
 
                 assert crd != null : tx.topologyVersion();
 
-                if (crd.isLocal())
+                if (crd.node().isLocal())
                     onMvccResponse(cctx.localNodeId(), cctx.coordinators().requestTxCounterOnCoordinator(tx));
                 else {
-                    IgniteInternalFuture<Long> crdCntrFut = cctx.coordinators().requestTxCounter(crd, this, tx.nearXidVersion());
+                    IgniteInternalFuture<Long> crdCntrFut = cctx.coordinators().requestTxCounter(crd.node(),
+                        this,
+                        tx.nearXidVersion());
 
                     if (tx.onePhaseCommit())
                         waitCrdCntrFut = crdCntrFut;

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/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 7c2e0a5..1476b2a 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
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedExceptio
 import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryFuture;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
@@ -77,7 +78,7 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
     private static IgniteLogger log;
 
     /** */
-    private ClusterNode mvccCrd;
+    private MvccCoordinator mvccCrd;
 
     /** */
     private MvccCoordinatorVersion mvccVer;
@@ -128,11 +129,6 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
             log = U.logger(cctx.kernalContext(), logRef, GridPartitionedGetFuture.class);
     }
 
-    /** {@inheritDoc} */
-    @Nullable @Override public MvccCoordinatorVersion onCoordinatorChange(ClusterNode oldCrd, ClusterNode newCrd) {
-        return null;
-    }
-
     /**
      * Initializes future.
      *
@@ -151,22 +147,51 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
                 canRemap ? cctx.affinity().affinityTopologyVersion() : cctx.shared().exchange().readyAffinityVersion();
         }
 
-        // TODO IGNITE-3478 (correct failover and remap).
         if (cctx.mvccEnabled()) {
+            trackable = true;
+
+            cctx.mvcc().addFuture(this, futId);
+
+            requestMvccVersionAndMap(topVer);
 
             return;
         }
 
+        initialMap(topVer);
+    }
+
+    /**
+     * @param topVer Topology version.
+     */
+    private void initialMap(AffinityTopologyVersion topVer) {
         map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer);
 
         markInitialized();
     }
 
+    /** {@inheritDoc} */
+    @Nullable @Override public MvccCoordinatorVersion onMvccCoordinatorChange(MvccCoordinator newCrd) {
+        if (!cctx.mvccEnabled())
+            return null;
+
+        synchronized (this) {
+            if (mvccVer != null) {
+                mvccCrd = newCrd;
+
+                return mvccVer;
+            }
+            else if (mvccCrd != null)
+                mvccCrd = null;
+
+            return null;
+        }
+    }
+
     /**
-     *
+     * @param topVer Topology version.
      */
-    private void requestMvccVersion(final AffinityTopologyVersion topVer) {
-        mvccCrd = cctx.affinity().mvccCoordinator(topVer);
+    private void requestMvccVersionAndMap(final AffinityTopologyVersion topVer) {
+        MvccCoordinator mvccCrd = cctx.affinity().mvccCoordinator(topVer);
 
         if (mvccCrd == null) {
             onDone(new IgniteCheckedException("Mvcc coordinator is not assigned: " + topVer));
@@ -174,28 +199,64 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
             return;
         }
 
-            final AffinityTopologyVersion topVer0 = topVer;IgniteInternalFuture<MvccCoordinatorVersion> cntrFut = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
+        synchronized (this) {
+            this.mvccCrd = mvccCrd;
+        }
+
+        MvccCoordinator curCrd = cctx.topology().mvccCoordinator();
+
+        if (!mvccCrd.equals(curCrd)) {
+            assert cctx.topology().topologyVersionFuture().initialVersion().compareTo(topVer) > 0;
+
+            // TODO IGNITE-3479.
+        }
+
+        IgniteInternalFuture<MvccCoordinatorVersion> cntrFut = cctx.shared().coordinators().requestQueryCounter(mvccCrd.node());
 
         cntrFut.listen(new IgniteInClosure<IgniteInternalFuture<MvccCoordinatorVersion>>() {
             @Override public void apply(IgniteInternalFuture<MvccCoordinatorVersion> fut) {
+                boolean needRemap = false;
+
                 try {
-                    mvccVer = fut.get();
+                    MvccCoordinatorVersion rcvdVer = fut.get();
 
-                    map(keys,
-                        Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(),
-                        topVer);
+                    synchronized (GridPartitionedGetFuture.class) {
+                        if (GridPartitionedGetFuture.this.mvccCrd != null) {
+                            mvccVer = rcvdVer;
+                        }
+                        else
+                            needRemap = true;
+                    }
 
-                    markInitialized();
+                    if (!needRemap)
+                        initialMap(topVer);
                 }
                 catch (ClusterTopologyCheckedException e) {
-                    if (canRemap) {
-
-                    }
-                    else
-                        onDone(new ClusterTopologyCheckedException("Failed to request mvcc version, coordinator failed: " + mvccCrd));
+                    needRemap = true;
                 }
                 catch (IgniteCheckedException e) {
-                    onDone(e);
+                    GridPartitionedGetFuture.this.onDone(e);
+                }
+
+                if (needRemap) {
+                    if (canRemap) {
+                        IgniteInternalFuture<AffinityTopologyVersion> waitFut = waitRemapFuture(topVer);
+
+                        waitFut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
+                            @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> fut) {
+                                try {
+                                    requestMvccVersionAndMap(fut.get());
+                                }
+                                catch (IgniteCheckedException e) {
+                                    GridPartitionedGetFuture.this.onDone(e);
+                                }
+                            }
+                        });
+                    }
+                    else {
+                        GridPartitionedGetFuture.this.onDone(new ClusterTopologyCheckedException("Failed to " +
+                            "request mvcc version, coordinator failed"));
+                    }
                 }
             }
         });
@@ -258,10 +319,23 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
             if (trackable)
                 cctx.mvcc().removeFuture(futId);
 
-            if (mvccVer != null) {
-                assert mvccCrd != null;
+            if (cctx.mvccEnabled()) {
+                MvccCoordinator mvccCrd0 = null;
+                MvccCoordinatorVersion mvccVer0 = null;
+
+                synchronized (this) {
+                    if (mvccVer != null) {
+                        assert mvccCrd != null;
 
-                cctx.shared().coordinators().ackQueryDone(mvccCrd, mvccVer);
+                        mvccCrd0 = mvccCrd;
+                        mvccVer0 = mvccVer;
+
+                        mvccVer = null;
+                    }
+                }
+
+                if (mvccVer0 != null)
+                    cctx.shared().coordinators().ackQueryDone(mvccCrd0.node(), mvccVer0);
             }
 
             cache().sendTtlUpdateRequest(expiryPlc);
@@ -679,6 +753,17 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
         return Collections.emptyMap();
     }
 
+    /**
+     * @param curTopVer Current topology version.
+     * @return Future to wait for before remapping.
+     */
+    private IgniteInternalFuture<AffinityTopologyVersion> waitRemapFuture(AffinityTopologyVersion curTopVer) {
+        AffinityTopologyVersion updTopVer =
+            new AffinityTopologyVersion(Math.max(curTopVer.topologyVersion() + 1, cctx.discovery().topologyVersion()));
+
+        return cctx.affinity().affinityReadyFuture(updTopVer);
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
@@ -783,17 +868,15 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
                 onDone(Collections.<K, V>emptyMap());
             }
             else {
-                final AffinityTopologyVersion updTopVer =
-                    new AffinityTopologyVersion(Math.max(topVer.topologyVersion() + 1, cctx.discovery().topologyVersion()));
+                IgniteInternalFuture<AffinityTopologyVersion> waitFut = waitRemapFuture(topVer);
 
-                cctx.affinity().affinityReadyFuture(updTopVer).listen(
-                    new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
+                waitFut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
                         @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> fut) {
                             try {
-                                fut.get();
+                                AffinityTopologyVersion topVer = fut.get();
 
                                 // Remap.
-                                map(keys.keySet(), F.t(node, keys), updTopVer);
+                                map(keys.keySet(), F.t(node, keys), topVer);
 
                                 onDone(Collections.<K, V>emptyMap());
                             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/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 30e5621..1642263 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
@@ -68,6 +68,7 @@ import org.apache.ignite.internal.processors.cache.ExchangeActions;
 import org.apache.ignite.internal.processors.cache.ExchangeContext;
 import org.apache.ignite.internal.processors.cache.ExchangeDiscoveryEvents;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.StateChangeRequest;
@@ -76,6 +77,10 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalP
 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.GridDhtTopologyFutureAdapter;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCounter;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryFuture;
 import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDiscoveryMessage;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -553,25 +558,27 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
 
             boolean crdNode = crd != null && crd.isLocal();
 
-            boolean mvccCrdChange = false;
+            boolean newMvccCrd = false;
 
-            if (localJoinExchange())
-                cctx.coordinators().reassignCoordinator(firstEvtDiscoCache);
-            else if (exchId.isLeft()){
-                ClusterNode mvccCrd = cctx.coordinators().currentCoordinator();
-
-                if (mvccCrd != null && mvccCrd.equals(exchId.eventNode())) {
-                    assert !CU.clientNode(mvccCrd) : mvccCrd;
+            if (localJoinExchange()) {
+                MvccCoordinator mvccCrd = cctx.coordinators().currentCoordinator();
 
-                    ClusterNode newMvccCrd = cctx.coordinators().reassignCoordinator(firstEvtDiscoCache);
+                if (mvccCrd == null) {
+                    newMvccCrd = cctx.coordinators().reassignCoordinator(firstEvtDiscoCache) != null &&
+                        srvNodes.size() == 1;
+                }
+            }
+            else if (exchId.isLeft()){
+                MvccCoordinator mvccCrd = cctx.coordinators().currentCoordinator();
 
-                    assert !F.eq(mvccCrd, newMvccCrd);
+                if (mvccCrd != null && mvccCrd.node().equals(exchId.eventNode())) {
+                    assert !CU.clientNode(mvccCrd.node()) : mvccCrd;
 
-                    mvccCrdChange = newMvccCrd != null;
+                    newMvccCrd = cctx.coordinators().reassignCoordinator(firstEvtDiscoCache) != null;
                 }
             }
 
-            exchCtx = new ExchangeContext(crdNode, mvccCrdChange, this);
+            exchCtx = new ExchangeContext(crdNode, newMvccCrd, this);
 
             assert state == null : state;
 
@@ -663,7 +670,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                 }
             }
 
-            updateTopologies(crdNode);
+            updateTopologies(crdNode, cctx.coordinators().currentCoordinator());
 
             switch (exchange) {
                 case ALL: {
@@ -767,9 +774,10 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
 
     /**
      * @param crd Coordinator flag.
+     * @param mvccCrd Mvcc coordinator.
      * @throws IgniteCheckedException If failed.
      */
-    private void updateTopologies(boolean crd) throws IgniteCheckedException {
+    private void updateTopologies(boolean crd, MvccCoordinator mvccCrd) throws IgniteCheckedException {
         for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
             if (grp.isLocal())
                 continue;
@@ -795,12 +803,46 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             top.updateTopologyVersion(
                 this,
                 events().discoveryCache(),
+                mvccCrd,
                 updSeq,
                 cacheGroupStopping(grp.groupId()));
         }
 
-        for (GridClientPartitionTopology top : cctx.exchange().clientTopologies())
-            top.updateTopologyVersion(this, events().discoveryCache(), -1, cacheGroupStopping(top.groupId()));
+        for (GridClientPartitionTopology top : cctx.exchange().clientTopologies()) {
+            top.updateTopologyVersion(this,
+                events().discoveryCache(),
+                mvccCrd,
+                -1,
+                cacheGroupStopping(top.groupId()));
+        }
+
+        if (exchCtx.newMvccCoordinator()) {
+            assert mvccCrd != null;
+
+            Map<MvccCounter, Integer> activeQrys = null;
+
+            for (GridCacheFuture<?> fut : cctx.mvcc().activeFutures()) {
+                if (fut instanceof MvccQueryFuture) {
+                    MvccCoordinatorVersion ver = ((MvccQueryFuture)fut).onMvccCoordinatorChange(mvccCrd);
+
+                    if (ver != null ) {
+                        MvccCounter cntr = new MvccCounter(ver.coordinatorVersion(), ver.counter());
+
+                        if (activeQrys == null)
+                            activeQrys = new HashMap<>();
+
+                        Integer cnt = activeQrys.get(cntr);
+
+                        if (cnt == null)
+                            activeQrys.put(cntr, 1);
+                        else
+                            activeQrys.put(cntr, cnt + 1);
+                    }
+                }
+            }
+
+            exchCtx.addActiveQueries(activeQrys);
+        }
     }
 
     /**
@@ -1262,6 +1304,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                 msg.partitionHistoryCounters(partHistReserved0);
         }
 
+        msg.activeQueries(exchCtx.activeQueries());
+
         if (stateChangeExchange() && changeGlobalStateE != null)
             msg.setError(changeGlobalStateE);
         else if (localJoinExchange())
@@ -1437,6 +1481,9 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
         }
 
         if (err == null) {
+            if (exchCtx.newMvccCoordinator() && cctx.localNode().equals(cctx.coordinators().currentCoordinatorNode()))
+                cctx.coordinators().initCoordinator(res, exchCtx.activeQueries());
+
             if (centralizedAff) {
                 assert !exchCtx.mergeExchanges();
 
@@ -2277,6 +2324,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             for (Map.Entry<UUID, GridDhtPartitionsSingleMessage> e : msgs.entrySet()) {
                 GridDhtPartitionsSingleMessage msg = e.getValue();
 
+                exchCtx.addActiveQueries(msg.activeQueries());
+
                 // Apply update counters after all single messages are received.
                 for (Map.Entry<Integer, GridDhtPartitionMap> entry : msg.partitions().entrySet()) {
                     Integer grpId = entry.getKey();

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/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 215152d..c461e4c 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
@@ -29,12 +29,14 @@ import org.apache.ignite.internal.GridDirectMap;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCounter;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -100,6 +102,10 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
      */
     private GridDhtPartitionsFullMessage finishMsg;
 
+    /** */
+    @GridDirectMap(keyType = Message.class, valueType = Integer.class)
+    private Map<MvccCounter, Integer> activeQrys;
+
     /**
      * Required by {@link Externalizable}.
      */
@@ -124,6 +130,20 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
     }
 
     /**
+     * @return Active queries started with previous coordinator.
+     */
+    Map<MvccCounter, Integer> activeQueries() {
+        return activeQrys;
+    }
+
+    /**
+     * @param activeQrys Active queries started with previous coordinator.
+     */
+    void activeQueries(Map<MvccCounter, Integer> activeQrys) {
+        this.activeQrys = activeQrys;
+    }
+
+    /**
      * @param finishMsg Exchange finish message (used to restore exchange state on new coordinator).
      */
     void finishMessage(GridDhtPartitionsFullMessage finishMsg) {
@@ -404,48 +424,54 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
 
         switch (writer.state()) {
             case 5:
-                if (!writer.writeBoolean("client", client))
+                if (!writer.writeMap("activeQrys", activeQrys, MessageCollectionItemType.MSG, MessageCollectionItemType.INT))
                     return false;
 
                 writer.incrementState();
 
             case 6:
-                if (!writer.writeMap("dupPartsData", dupPartsData, MessageCollectionItemType.INT, MessageCollectionItemType.INT))
+                if (!writer.writeBoolean("client", client))
                     return false;
 
                 writer.incrementState();
 
             case 7:
-                if (!writer.writeByteArray("errBytes", errBytes))
+                if (!writer.writeMap("dupPartsData", dupPartsData, MessageCollectionItemType.INT, MessageCollectionItemType.INT))
                     return false;
 
                 writer.incrementState();
 
             case 8:
-                if (!writer.writeMessage("finishMsg", finishMsg))
+                if (!writer.writeByteArray("errBytes", errBytes))
                     return false;
 
                 writer.incrementState();
 
             case 9:
-                if (!writer.writeCollection("grpsAffRequest", grpsAffRequest, MessageCollectionItemType.INT))
+                if (!writer.writeMessage("finishMsg", finishMsg))
                     return false;
 
                 writer.incrementState();
 
             case 10:
-                if (!writer.writeByteArray("partCntrsBytes", partCntrsBytes))
+                if (!writer.writeCollection("grpsAffRequest", grpsAffRequest, MessageCollectionItemType.INT))
                     return false;
 
                 writer.incrementState();
 
             case 11:
-                if (!writer.writeByteArray("partHistCntrsBytes", partHistCntrsBytes))
+                if (!writer.writeByteArray("partCntrsBytes", partCntrsBytes))
                     return false;
 
                 writer.incrementState();
 
             case 12:
+                if (!writer.writeByteArray("partHistCntrsBytes", partHistCntrsBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
                 if (!writer.writeByteArray("partsBytes", partsBytes))
                     return false;
 
@@ -468,7 +494,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
 
         switch (reader.state()) {
             case 5:
-                client = reader.readBoolean("client");
+                activeQrys = reader.readMap("activeQrys", MessageCollectionItemType.MSG, MessageCollectionItemType.INT, false);
 
                 if (!reader.isLastRead())
                     return false;
@@ -476,7 +502,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
                 reader.incrementState();
 
             case 6:
-                dupPartsData = reader.readMap("dupPartsData", MessageCollectionItemType.INT, MessageCollectionItemType.INT, false);
+                client = reader.readBoolean("client");
 
                 if (!reader.isLastRead())
                     return false;
@@ -484,7 +510,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
                 reader.incrementState();
 
             case 7:
-                errBytes = reader.readByteArray("errBytes");
+                dupPartsData = reader.readMap("dupPartsData", MessageCollectionItemType.INT, MessageCollectionItemType.INT, false);
 
                 if (!reader.isLastRead())
                     return false;
@@ -492,7 +518,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
                 reader.incrementState();
 
             case 8:
-                finishMsg = reader.readMessage("finishMsg");
+                errBytes = reader.readByteArray("errBytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -500,7 +526,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
                 reader.incrementState();
 
             case 9:
-                grpsAffRequest = reader.readCollection("grpsAffRequest", MessageCollectionItemType.INT);
+                finishMsg = reader.readMessage("finishMsg");
 
                 if (!reader.isLastRead())
                     return false;
@@ -508,7 +534,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
                 reader.incrementState();
 
             case 10:
-                partCntrsBytes = reader.readByteArray("partCntrsBytes");
+                grpsAffRequest = reader.readCollection("grpsAffRequest", MessageCollectionItemType.INT);
 
                 if (!reader.isLastRead())
                     return false;
@@ -516,7 +542,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
                 reader.incrementState();
 
             case 11:
-                partHistCntrsBytes = reader.readByteArray("partHistCntrsBytes");
+                partCntrsBytes = reader.readByteArray("partCntrsBytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -524,6 +550,14 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
                 reader.incrementState();
 
             case 12:
+                partHistCntrsBytes = reader.readByteArray("partHistCntrsBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
                 partsBytes = reader.readByteArray("partsBytes");
 
                 if (!reader.isLastRead())
@@ -543,7 +577,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 13;
+        return 14;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index 75a2b87..80fd326 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTx
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxMapping;
 import org.apache.ignite.internal.processors.cache.mvcc.CacheCoordinatorsSharedManager;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinatorVersion;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccResponseListener;
 import org.apache.ignite.internal.processors.cache.mvcc.TxMvccInfo;
@@ -295,13 +296,15 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
                 nodes = cacheCtx.affinity().nodesByKey(txEntry.key(), topVer);
 
             if (mvccCrd == null && cacheCtx.mvccEnabled()) {
-                mvccCrd = cacheCtx.affinity().mvccCoordinator(topVer);
+                MvccCoordinator mvccCrd0 = cacheCtx.affinity().mvccCoordinator(topVer);
 
-                if (mvccCrd == null) {
+                if (mvccCrd0 == null) {
                     onDone(new IgniteCheckedException("Mvcc coordinator is not assigned: " + topVer));
 
                     return;
                 }
+                else
+                    mvccCrd = mvccCrd0.node();
             }
 
             if (F.isEmpty(nodes)) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java
index dff1b53..2bf653c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsSharedManager.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.mvcc;
 
+import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -71,7 +72,7 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
     private static final byte MSG_POLICY = SYSTEM_POOL;
     
     /** */
-    private volatile Coordinator curCrd;
+    private volatile MvccCoordinator curCrd;
 
     /** */
     private final AtomicLong mvccCntr = new AtomicLong(1L);
@@ -106,6 +107,23 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
     /** */
     private StatCounter[] statCntrs;
 
+    /**
+     * @param ver1 First version.
+     * @param ver2 Second version.
+     * @return
+     */
+    public static int compareVersions(MvccCoordinatorVersion ver1, MvccCoordinatorVersion ver2) {
+        assert ver1 != null;
+        assert ver2 != null;
+
+        int cmp = Long.compare(ver1.coordinatorVersion(), ver2.coordinatorVersion());
+
+        if (cmp != 0)
+            return cmp;
+
+        return Long.compare(ver1.counter(), ver2.counter());
+    }
+
     /** {@inheritDoc} */
     @Override protected void start0() throws IgniteCheckedException {
         super.start0();
@@ -143,7 +161,7 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
      * @return Counter.
      */
     public MvccCoordinatorVersion requestTxCounterOnCoordinator(IgniteInternalTx tx) {
-        assert cctx.localNode().equals(currentCoordinator());
+        assert cctx.localNode().equals(currentCoordinatorNode());
 
         return assignTxCounter(tx.nearXidVersion(), 0L);
     }
@@ -681,48 +699,52 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
         }
     }
 
-    public ClusterNode currentCoordinator() {
-        Coordinator crd = curCrd;
+    public MvccCoordinator currentCoordinator() {
+        return curCrd;
+    }
 
-        return crd != null ? crd.crd : null;
+    public ClusterNode currentCoordinatorNode() {
+        MvccCoordinator curCrd = this.curCrd;
+
+        return curCrd != null ? curCrd.node() : null;
     }
 
-    public ClusterNode currentCoordinatorForCacheAffinity(AffinityTopologyVersion topVer) {
-        Coordinator crd = curCrd;
+    public MvccCoordinator currentCoordinatorForCacheAffinity(AffinityTopologyVersion topVer) {
+        MvccCoordinator crd = curCrd;
 
-        assert crd == null || crd.topVer.compareTo(topVer) <= 0 : crd;
+        // Assert coordinator did not already change.
+        assert crd == null || crd.topologyVersion().compareTo(topVer) <= 0 : crd;
 
-        return crd != null ? crd.crd : null;
+        return crd;
     }
 
     /**
      * @param discoCache Discovery snapshot.
      */
-    public ClusterNode reassignCoordinator(DiscoCache discoCache) {
-        ClusterNode curCrd = currentCoordinator();
-
-        assert curCrd == null || !discoCache.allNodes().contains(curCrd) : curCrd;
-
-        ClusterNode newCrd;
+    public MvccCoordinator reassignCoordinator(DiscoCache discoCache) {
+        assert curCrd == null || !discoCache.allNodes().contains(curCrd.node()) : curCrd;
 
         if (!discoCache.serverNodes().isEmpty()) {
-            newCrd = discoCache.serverNodes().get(0);
-
-            if (cctx.localNode().equals(newCrd)) {
-                crdVer = discoCache.version().topologyVersion();
-
-                crdLatch.countDown();
-            }
+            curCrd = new MvccCoordinator(discoCache.serverNodes().get(0), discoCache.version());
 
             log.info("Assigned mvcc coordinator [topVer=" + discoCache.version() +
-                ", crd=" + newCrd + ']');
+                ", crd=" + curCrd.node().id() + ']');
         }
         else
-            newCrd = null;
+            curCrd = null;
 
-        this.curCrd = new Coordinator(newCrd, discoCache.version());
+        return curCrd;
+    }
 
-        return newCrd;
+    public void initCoordinator(AffinityTopologyVersion topVer, @Nullable Map<MvccCounter, Integer> activeQrys) {
+        assert cctx.localNode().equals(curCrd.node());
+
+        log.info("Initialize local node as mvcc coordinator [node=" + cctx.localNodeId() +
+            ", topVer=" + topVer + ']');
+
+        crdVer = topVer.topologyVersion();
+
+        crdLatch.countDown();
     }
 
     /**
@@ -1000,20 +1022,4 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
             this.txId = txId;
         }
     }
-
-    /**
-     *
-     */
-    static class Coordinator {
-        /** */
-        final ClusterNode crd;
-
-        /** */
-        final AffinityTopologyVersion topVer;
-
-        Coordinator(ClusterNode crd, AffinityTopologyVersion topVer) {
-            this.crd = crd;
-            this.topVer = topVer;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCoordinator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCoordinator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCoordinator.java
index cc92cc3..2affc5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCoordinator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCoordinator.java
@@ -1,7 +1,65 @@
+/*
+ * 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.mvcc;
 
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+
 /**
  *
  */
 public class MvccCoordinator {
+    /** */
+    private final ClusterNode crd;
+
+    /** */
+    private final AffinityTopologyVersion topVer;
+
+    public MvccCoordinator(ClusterNode crd, final AffinityTopologyVersion topVer) {
+        this.crd = crd;
+        this.topVer = topVer;
+    }
+
+    public ClusterNode node() {
+        return crd;
+    }
+
+    public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    @Override public boolean equals(Object other) {
+        if (this == other)
+            return true;
+
+        if (other == null || getClass() != other.getClass())
+            return false;
+
+        MvccCoordinator that = (MvccCoordinator)other;
+
+        return topVer.equals(topVer) && crd.equals(that.crd);
+    }
+
+    @Override public int hashCode() {
+        int res = crd.hashCode();
+
+        res = 31 * res + topVer.hashCode();
+
+        return res;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCounter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCounter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCounter.java
new file mode 100644
index 0000000..847822e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCounter.java
@@ -0,0 +1,100 @@
+/*
+ * 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.mvcc;
+
+import java.nio.ByteBuffer;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+
+/**
+ *
+ */
+public class MvccCounter implements Message {
+    /** */
+    private long crdVer;
+
+    /** */
+    private long cntr;
+
+    public MvccCounter() {
+        // No-po.
+    }
+
+    public MvccCounter(long crdVer, long cntr) {
+        this.crdVer = crdVer;
+        this.cntr = cntr;
+    }
+
+    public long coordinatorVersion() {
+        return crdVer;
+    }
+
+    public long counter() {
+        return cntr;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        MvccCounter that = (MvccCounter) o;
+
+        return crdVer == that.crdVer && cntr == that.cntr;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = (int) (crdVer ^ (crdVer >>> 32));
+        res = 31 * res + (int) (cntr ^ (cntr >>> 32));
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public short directType() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onAckReceived() {
+        // No-op.
+    }
+
+    @Override public String toString() {
+        return super.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java
index 1463577..4d66437 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccQueryFuture.java
@@ -17,12 +17,11 @@
 
 package org.apache.ignite.internal.processors.cache.mvcc;
 
-import org.apache.ignite.cluster.ClusterNode;
 import org.jetbrains.annotations.Nullable;
 
 /**
  *
  */
 public interface MvccQueryFuture {
-    @Nullable public MvccCoordinatorVersion onCoordinatorChange(ClusterNode oldCrd, ClusterNode newCrd);
+    @Nullable public MvccCoordinatorVersion onMvccCoordinatorChange(MvccCoordinator newCrd);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
index 3c43768..f5df18b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
@@ -539,7 +539,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
             final MvccCoordinatorVersion mvccVer;
 
             if (cctx.mvccEnabled()) {
-                mvccCrd = cctx.affinity().mvccCoordinator(cctx.shared().exchange().readyAffinityVersion());
+                mvccCrd = cctx.affinity().mvccCoordinator(cctx.shared().exchange().readyAffinityVersion()).node();
 
                 IgniteInternalFuture<MvccCoordinatorVersion> fut0 = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index f46f8d2..67bd6e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -1465,7 +1465,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
             // TODO IGNITE-3478.
             if (cctx.mvccEnabled()) {
-                mvccCrd = cctx.affinity().mvccCoordinator(cctx.shared().exchange().readyAffinityVersion());
+                mvccCrd = cctx.affinity().mvccCoordinator(cctx.shared().exchange().readyAffinityVersion()).node();
 
                 IgniteInternalFuture<MvccCoordinatorVersion> fut0 = cctx.shared().coordinators().requestQueryCounter(mvccCrd);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/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 0081ec2..92e6785 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
@@ -358,6 +358,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
      * @param ret Result.
      */
     public void implicitSingleResult(GridCacheReturn ret) {
+        assert ret != null;
+
         if (ret.invokeResult())
             implicitRes.mergeEntryProcessResults(ret);
         else

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
index a724060..87f5882 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
@@ -285,12 +285,12 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
                 onDone(rdc != null ? rdc.reduce() : null);
             }
             catch (RuntimeException e) {
-                logError(null, "Failed to execute compound future reducer: " + this, e);
+                logError(logger(), "Failed to execute compound future reducer: " + this, e);
 
                 onDone(e);
             }
             catch (AssertionError e) {
-                logError(null, "Failed to execute compound future reducer: " + this, e);
+                logError(logger(), "Failed to execute compound future reducer: " + this, e);
 
                 onDone(e);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/331a255c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
index 6b01aef..1b8a509 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
@@ -1675,7 +1675,7 @@ public class CacheMvccTransactionsTest extends GridCommonAbstractTest {
      *
      * @throws Exception If failed.
      */
-    public void _testReadInProgressCoordinatorFails() throws Exception {
+    public void testReadInProgressCoordinatorFails() throws Exception {
         testSpi = true;
 
         startGrids(4);
@@ -1766,6 +1766,82 @@ public class CacheMvccTransactionsTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testMvccCoordinatorChangeSimple() throws Exception {
+        Ignite srv0 = startGrid(0);
+
+        final List<String> cacheNames = new ArrayList<>();
+
+        for (CacheConfiguration ccfg : cacheConfigurations()) {
+            ccfg.setName("cache-" + cacheNames.size());
+
+            cacheNames.add(ccfg.getName());
+
+            srv0.createCache(ccfg);
+        }
+
+        checkPutGet(cacheNames);
+
+        for (int i = 0; i < 3; i++) {
+            startGrid(i + 1);
+
+            checkPutGet(cacheNames);
+        }
+
+        client = true;
+
+        for (int i = 0; i < 3; i++) {
+            Ignite node = startGrid(i + 4);
+
+            // Init client caches outside of transactions.
+            for (String cacheName : cacheNames)
+                node.cache(cacheName);
+
+            checkPutGet(cacheNames);
+        }
+
+        for (int i = 0; i < 3; i++) {
+            stopGrid(i);
+
+            checkPutGet(cacheNames);
+        }
+    }
+
+    /**
+     * @param cacheNames Cache names.
+     */
+    private void checkPutGet(List<String> cacheNames) {
+        List<Ignite> nodes = G.allGrids();
+
+        assertFalse(nodes.isEmpty());
+
+        Ignite putNode = nodes.get(ThreadLocalRandom.current().nextInt(nodes.size()));
+
+        Map<Integer, Integer> vals = new HashMap();
+
+        Integer val = ThreadLocalRandom.current().nextInt();
+
+        for (int i = 0; i < 10; i++)
+            vals.put(i, val);
+
+        try (Transaction tx = putNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+            for (String cacheName : cacheNames)
+                putNode.cache(cacheName).putAll(vals);
+
+            tx.commit();
+        }
+
+        for (Ignite node : nodes) {
+            for (String cacheName : cacheNames) {
+                Map<Object, Object> res = node.cache(cacheName).getAll(vals.keySet());
+
+                assertEquals(vals, res);
+            }
+        }
+    }
+
+    /**
      * @param N Number of object to update in single transaction.
      * @param srvs Number of server nodes.
      * @param clients Number of client nodes.


[07/17] ignite git commit: IGNITE-6486 .NET: Update IsActiveOnStart documentation

Posted by sb...@apache.org.
IGNITE-6486 .NET: Update IsActiveOnStart documentation

This closes #2729


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

Branch: refs/heads/ignite-3479
Commit: 6f1ca419fab840b920d408336ced69abaa4147cf
Parents: 6aa94a9
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 25 13:05:32 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 25 13:05:32 2017 +0300

----------------------------------------------------------------------
 .../configuration/IgniteConfiguration.java      |  6 +++
 .../Cache/PersistentStoreTest.cs                | 47 +++-----------------
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  3 ++
 3 files changed, 15 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6f1ca419/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 6e91b10..a79d436 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -2207,6 +2207,9 @@ public class IgniteConfiguration {
      * significantly speed up large topology startup time.
      * <p>
      * Default value is {@link #DFLT_ACTIVE_ON_START}.
+     * <p>
+     * This flag is ignored when {@link PersistentStoreConfiguration} is present:
+     * cluster is always inactive on start when Ignite Persistence is enabled.
      *
      * @return Active on start flag value.
      */
@@ -2217,6 +2220,9 @@ public class IgniteConfiguration {
     /**
      * Sets flag indicating whether the cluster will be active on start. This value should be the same on all
      * nodes in the cluster.
+     * <p>
+     * This flag is ignored when {@link PersistentStoreConfiguration} is present:
+     * cluster is always inactive on start when Ignite Persistence is enabled.
      *
      * @param activeOnStart Active on start flag value.
      * @return {@code this} instance.

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f1ca419/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
index d321639..a592859 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
@@ -18,7 +18,6 @@
 namespace Apache.Ignite.Core.Tests.Cache
 {
     using System.IO;
-    using Apache.Ignite.Core.Cache.Configuration;
     using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Impl;
     using Apache.Ignite.Core.PersistentStore;
@@ -52,15 +51,14 @@ namespace Apache.Ignite.Core.Tests.Cache
         [Test]
         public void TestCacheDataSurvivesNodeRestart()
         {
-            var cfg = new IgniteConfiguration(GetTestConfiguration())
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
             {
                 PersistentStoreConfiguration = new PersistentStoreConfiguration
                 {
                     PersistentStorePath = Path.Combine(_tempDir, "Store"),
                     WalStorePath = Path.Combine(_tempDir, "WalStore"),
                     WalArchivePath = Path.Combine(_tempDir, "WalArchive"),
-                    MetricsEnabled = true,
-                    CheckpointingPageBufferSize = 1024 * 1024  // TODO: Use default (IGNITE-5717)
+                    MetricsEnabled = true
                 }
             };
 
@@ -115,14 +113,12 @@ namespace Apache.Ignite.Core.Tests.Cache
         [Test]
         public void TestGridActivationWithPersistence()
         {
-            var cfg = new IgniteConfiguration(GetTestConfiguration())
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
             {
-                PersistentStoreConfiguration = new PersistentStoreConfiguration
-                {
-                    CheckpointingPageBufferSize = 1024 * 1024  // TODO: Use default (IGNITE-5717)
-                }
+                PersistentStoreConfiguration = new PersistentStoreConfiguration()
             };
 
+            // Default config, inactive by default (IsActiveOnStart is ignored when persistence is enabled).
             using (var ignite = Ignition.Start(cfg))
             {
                 CheckIsActive(ignite, false);
@@ -134,7 +130,7 @@ namespace Apache.Ignite.Core.Tests.Cache
                 CheckIsActive(ignite, false);
             }
         }
-        
+
         /// <summary>
         /// Tests the grid activation without persistence (active by default).
         /// </summary>
@@ -189,36 +185,5 @@ namespace Apache.Ignite.Core.Tests.Cache
                     ex.Message.Substring(0, 62));
             }
         }
-
-        /// <summary>
-        /// Gets the test configuration.
-        /// </summary>
-        private static IgniteConfiguration GetTestConfiguration()
-        {
-            return new IgniteConfiguration(TestUtils.GetTestConfiguration())
-            {
-                MemoryConfiguration = GetMemoryConfig()
-            };
-        }
-
-        /// <summary>
-        /// Gets the memory configuration with reduced MaxMemory to work around persistence bug.
-        /// </summary>
-        private static MemoryConfiguration GetMemoryConfig()
-        {
-            // TODO: Remove this method and use default config (IGNITE-5717).
-            return new MemoryConfiguration
-            {
-                MemoryPolicies = new[]
-                {
-                    new MemoryPolicyConfiguration
-                    {
-                        Name = MemoryConfiguration.DefaultDefaultMemoryPolicyName,
-                        InitialSize = 512*1024*1024,
-                        MaxSize = 512*1024*1024
-                    }
-                }
-            };
-        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f1ca419/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 5ac2258..14cd375 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -1262,6 +1262,9 @@ namespace Apache.Ignite.Core
         /// <summary>
         /// Gets or sets a value indicating whether grid should be active on start.
         /// See also <see cref="IIgnite.IsActive"/> and <see cref="IIgnite.SetActive"/>.
+        /// <para />
+        /// This property is ignored when <see cref="PersistentStoreConfiguration"/> is present:
+        /// cluster is always inactive on start when Ignite Persistence is enabled.
         /// </summary>
         [DefaultValue(DefaultIsActiveOnStart)]
         public bool IsActiveOnStart


[09/17] ignite git commit: IGNITE-6493 fix IgnitePdsWalTlbTest.testWalDirectOutOfMemory() incorrect usage dataStreamer, must be in try-with-resource

Posted by sb...@apache.org.
IGNITE-6493 fix IgnitePdsWalTlbTest.testWalDirectOutOfMemory() incorrect usage dataStreamer, must be in try-with-resource

Signed-off-by: Andrey Gura <ag...@apache.org>


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

Branch: refs/heads/ignite-3479
Commit: 21cc7a486d3adfb79f5540d217e1a759076fd7ba
Parents: 68c100d
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Mon Sep 25 13:28:42 2017 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Mon Sep 25 13:28:42 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/21cc7a48/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
index fd0fd34..8b3cbf8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
@@ -113,9 +113,7 @@ public class IgnitePdsWalTlbTest extends GridCommonAbstractTest {
 
         boolean locked = true;
 
-        try {
-            IgniteDataStreamer<Integer, Integer> streamer = ig.dataStreamer(CACHE_NAME);
-
+        try (IgniteDataStreamer<Integer, Integer> streamer = ig.dataStreamer(CACHE_NAME)) {
             for (int i = 0; i < 100_000; i++) {
                 streamer.addData(i, 1);