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/06 14:34:29 UTC

[01/14] ignite git commit: IGNITE-5879 .NET: Move TestPlatformPlugin to a separate module

Repository: ignite
Updated Branches:
  refs/heads/ignite-3484 6be6779b6 -> 91b991173


http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosure.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosure.java
new file mode 100644
index 0000000..2763c4f
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosure.java
@@ -0,0 +1,48 @@
+/*
+ * 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.platform.plugin.cache;
+
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.plugin.CachePluginConfiguration;
+import org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosure;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * Test config closure.
+ */
+public class PlatformTestCachePluginConfigurationClosure implements PlatformCachePluginConfigurationClosure {
+    /** {@inheritDoc} */
+    @Override public void apply(CacheConfiguration cacheConfiguration, BinaryRawReader reader) {
+        ArrayList<CachePluginConfiguration> cfgs = new ArrayList<>();
+
+        if (cacheConfiguration.getPluginConfigurations() != null) {
+            Collections.addAll(cfgs, cacheConfiguration.getPluginConfigurations());
+        }
+
+        PlatformTestCachePluginConfiguration plugCfg = new PlatformTestCachePluginConfiguration();
+
+        plugCfg.setPluginProperty(reader.readString());
+
+        cfgs.add(plugCfg);
+
+        cacheConfiguration.setPluginConfigurations(cfgs.toArray(new CachePluginConfiguration[cfgs.size()]));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosureFactory.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosureFactory.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosureFactory.java
new file mode 100644
index 0000000..c294342
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosureFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.platform.plugin.cache;
+
+import org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosure;
+import org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory;
+
+/**
+ * Test closure factory.
+ */
+public class PlatformTestCachePluginConfigurationClosureFactory
+    implements PlatformCachePluginConfigurationClosureFactory {
+    /** {@inheritDoc} */
+    @Override public int id() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public PlatformCachePluginConfigurationClosure create() {
+        return new PlatformTestCachePluginConfigurationClosure();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginProvider.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginProvider.java
new file mode 100644
index 0000000..ba04411
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginProvider.java
@@ -0,0 +1,72 @@
+/*
+ * 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.platform.plugin.cache;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.plugin.CachePluginConfiguration;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.jetbrains.annotations.Nullable;
+
+import javax.cache.Cache;
+
+/**
+ * Test cache plugin provider.
+ */
+public class PlatformTestCachePluginProvider implements CachePluginProvider {
+    /** {@inheritDoc} */
+    @Override public void start() throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean cancel) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStart() throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onIgniteStop(boolean cancel) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void validate() throws IgniteCheckedException {
+        // No-op.
+    }
+
+    @Override public void validateRemote(CacheConfiguration locCfg, CacheConfiguration rmtCfg, ClusterNode rmtNode)
+        throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object unwrapCacheEntry(Cache.Entry entry, Class cls) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object createComponent(Class cls) {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/package-info.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/package-info.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/package-info.java
new file mode 100644
index 0000000..e8eb9be
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/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 platform tests related classes and interfaces.
+ */
+package org.apache.ignite.platform.plugin.cache;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/package-info.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/package-info.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/package-info.java
new file mode 100644
index 0000000..5c80677
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/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 platform tests related classes and interfaces.
+ */
+package org.apache.ignite.platform.plugin;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider b/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
new file mode 100644
index 0000000..30d00ae
--- /dev/null
+++ b/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
@@ -0,0 +1 @@
+org.apache.ignite.platform.plugin.PlatformTestPluginProvider

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory b/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory
new file mode 100644
index 0000000..a99b3b9
--- /dev/null
+++ b/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory
@@ -0,0 +1 @@
+org.apache.ignite.platform.plugin.cache.PlatformTestCachePluginConfigurationClosureFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory b/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory
new file mode 100644
index 0000000..ef79fbe
--- /dev/null
+++ b/modules/extdata/platform/src/test/resources/META-INF/services/org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory
@@ -0,0 +1 @@
+org.apache.ignite.platform.plugin.PlatformTestPluginConfigurationClosureFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
index 6c4040b..2065e41 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
@@ -81,6 +81,7 @@ namespace Apache.Ignite.Core.Impl.Common
             {
                 AppendTestClasses(ggHome + "\\examples", cpStr);
                 AppendTestClasses(ggHome + "\\modules", cpStr);
+                AppendTestClasses(ggHome + "\\modules\\extdata\\platform", cpStr);
             }
 
             string ggLibs = ggHome + "\\libs";

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a456da4..a57c7de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,6 +54,7 @@
         <module>modules/hadoop</module>
         <module>modules/extdata/p2p</module>
         <module>modules/extdata/uri</module>
+        <module>modules/extdata/platform</module>
         <module>modules/clients</module>
         <module>modules/spring</module>
         <module>modules/spring-data</module>


[06/14] ignite git commit: IGNITE-5344: JDBC thin driver: support Statement.closeOnCompletion. This closes #2131.

Posted by sb...@apache.org.
IGNITE-5344: JDBC thin driver: support Statement.closeOnCompletion. This closes #2131.


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

Branch: refs/heads/ignite-3484
Commit: 3a917572c9732795d1c027721d79a1a271e3f4cc
Parents: d6cbc50
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Sep 5 18:12:53 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Tue Sep 5 18:12:53 2017 +0300

----------------------------------------------------------------------
 .../jdbc/thin/JdbcThinStatementSelfTest.java    | 62 +++++++++++++++++++-
 .../internal/jdbc/thin/JdbcThinResultSet.java   | 29 ++++++++-
 .../internal/jdbc/thin/JdbcThinStatement.java   | 22 ++++---
 3 files changed, 101 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3a917572/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStatementSelfTest.java
index 92f7255..a6046be 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStatementSelfTest.java
@@ -300,6 +300,64 @@ public class JdbcThinStatementSelfTest extends JdbcThinAbstractSelfTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testCloseOnCompletionAfterQuery() throws Exception {
+        assert !stmt.isCloseOnCompletion() : "Invalid default closeOnCompletion";
+
+        ResultSet rs0 = stmt.executeQuery(SQL);
+
+        ResultSet rs1 = stmt.executeQuery(SQL);
+
+        assert rs0.isClosed() : "Result set must be closed implicitly";
+
+        assert !stmt.isClosed() : "Statement must not be closed";
+
+        rs1.close();
+
+        assert !stmt.isClosed() : "Statement must not be closed";
+
+        ResultSet rs2 = stmt.executeQuery(SQL);
+
+        stmt.closeOnCompletion();
+
+        assert stmt.isCloseOnCompletion() : "Invalid closeOnCompletion";
+
+        rs2.close();
+
+        assert stmt.isClosed() : "Statement must be closed";
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCloseOnCompletionBeforeQuery() throws Exception {
+        assert !stmt.isCloseOnCompletion() : "Invalid default closeOnCompletion";
+
+        ResultSet rs0 = stmt.executeQuery(SQL);
+
+        ResultSet rs1 = stmt.executeQuery(SQL);
+
+        assert rs0.isClosed() : "Result set must be closed implicitly";
+
+        assert !stmt.isClosed() : "Statement must not be closed";
+
+        rs1.close();
+
+        assert !stmt.isClosed() : "Statement must not be closed";
+
+        stmt.closeOnCompletion();
+
+        ResultSet rs2 = stmt.executeQuery(SQL);
+
+        assert stmt.isCloseOnCompletion() : "Invalid closeOnCompletion";
+
+        rs2.close();
+
+        assert stmt.isClosed() : "Statement must be closed";
+    }
+
+    /**
      * Person.
      */
     @SuppressWarnings("UnusedDeclaration")
@@ -309,11 +367,11 @@ public class JdbcThinStatementSelfTest extends JdbcThinAbstractSelfTest {
         private final int id;
 
         /** First name. */
-        @QuerySqlField(index = false)
+        @QuerySqlField
         private final String firstName;
 
         /** Last name. */
-        @QuerySqlField(index = false)
+        @QuerySqlField
         private final String lastName;
 
         /** Age. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3a917572/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
index c4be5bc..9457b30 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
@@ -100,6 +100,9 @@ public class JdbcThinResultSet implements ResultSet {
     /** Update count. */
     private long updCnt;
 
+    /** Close statement after close result set count. */
+    private boolean closeStmt;
+
     /** Jdbc metadata. Cache the JDBC object on the first access */
     private JdbcThinResultSetMetadata jdbcMeta;
 
@@ -139,10 +142,11 @@ public class JdbcThinResultSet implements ResultSet {
      * @param isQuery Is Result ser for Select query.
      * @param autoClose Is automatic close of server cursors enabled.
      * @param updCnt Update count.
+     * @param closeStmt Close statement on the result set close.
      */
     @SuppressWarnings("OverlyStrongTypeCast")
     JdbcThinResultSet(JdbcThinStatement stmt, long qryId, int fetchSize, boolean finished,
-        List<List<Object>> rows, boolean isQuery, boolean autoClose, long updCnt) {
+        List<List<Object>> rows, boolean isQuery, boolean autoClose, long updCnt, boolean closeStmt) {
         assert stmt != null;
         assert fetchSize > 0;
 
@@ -152,6 +156,7 @@ public class JdbcThinResultSet implements ResultSet {
         this.finished = finished;
         this.isQuery = isQuery;
         this.autoClose = autoClose;
+        this.closeStmt = closeStmt;
 
         if (isQuery) {
             this.fetchSize = fetchSize;
@@ -208,7 +213,17 @@ public class JdbcThinResultSet implements ResultSet {
 
     /** {@inheritDoc} */
     @Override public void close() throws SQLException {
-        if (closed || stmt == null || stmt.connection().isClosed())
+        if (closeStmt)
+            stmt.close();
+
+        close0();
+    }
+
+    /**
+     * @throws SQLException On error.
+     */
+    void close0() throws SQLException {
+        if (isClosed())
             return;
 
         try {
@@ -1259,7 +1274,7 @@ public class JdbcThinResultSet implements ResultSet {
 
     /** {@inheritDoc} */
     @Override public boolean isClosed() throws SQLException {
-        return stmt.isClosed() || closed;
+        return closed || stmt == null || stmt.connection().isClosed();
     }
 
     /** {@inheritDoc} */
@@ -1557,6 +1572,7 @@ public class JdbcThinResultSet implements ResultSet {
     }
 
     /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
     @Override public <T> T unwrap(Class<T> iface) throws SQLException {
         if (!isWrapperFor(iface))
             throw new SQLException("Result set is not a wrapper for " + iface.getName());
@@ -1723,6 +1739,13 @@ public class JdbcThinResultSet implements ResultSet {
     }
 
     /**
+     * @param closeStmt Close statement on this result set close.
+     */
+    void closeStatement(boolean closeStmt) {
+        this.closeStmt = closeStmt;
+    }
+
+    /**
      * @param val Number value.
      * @return Boolean value.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3a917572/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
index 59a9db0..59594ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
@@ -64,12 +64,15 @@ public class JdbcThinStatement implements Statement {
     /** Fetch size. */
     private int pageSize = DFLT_PAGE_SIZE;
 
-    /** */
+    /** Result set or update count has been already read. */
     private boolean alreadyRead;
 
     /** Batch. */
     protected List<JdbcQuery> batch;
 
+    /** Close this statement on result set close. */
+    private boolean closeOnCompletion;
+
     /**
      * Creates new statement.
      *
@@ -103,7 +106,7 @@ public class JdbcThinStatement implements Statement {
         ensureNotClosed();
 
         if (rs != null) {
-            rs.close();
+            rs.close0();
 
             rs = null;
         }
@@ -120,7 +123,7 @@ public class JdbcThinStatement implements Statement {
             assert res != null;
 
             rs = new JdbcThinResultSet(this, res.getQueryId(), pageSize, res.last(), res.items(),
-                res.isQuery(), conn.io().autoCloseServerCursor(), res.updateCount());
+                res.isQuery(), conn.io().autoCloseServerCursor(), res.updateCount(), closeOnCompletion);
         }
         catch (IOException e) {
             conn.close();
@@ -150,7 +153,7 @@ public class JdbcThinStatement implements Statement {
             return;
 
         if (rs != null)
-            rs.close();
+            rs.close0();
 
         closed = true;
     }
@@ -349,7 +352,7 @@ public class JdbcThinStatement implements Statement {
         ensureNotClosed();
 
         if (rs != null) {
-            rs.close();
+            rs.close0();
 
             rs = null;
         }
@@ -497,14 +500,19 @@ public class JdbcThinStatement implements Statement {
 
     /** {@inheritDoc} */
     @Override public void closeOnCompletion() throws SQLException {
-        throw new SQLFeatureNotSupportedException("closeOnCompletion is not supported.");
+        ensureNotClosed();
+
+        closeOnCompletion = true;
+
+        if (rs != null)
+            rs.closeStatement(true);
     }
 
     /** {@inheritDoc} */
     @Override public boolean isCloseOnCompletion() throws SQLException {
         ensureNotClosed();
 
-        return false;
+        return closeOnCompletion;
     }
 
     /**


[13/14] ignite git commit: Merge branch 'ignite-3478' into ignite-3484

Posted by sb...@apache.org.
Merge branch 'ignite-3478' into ignite-3484


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

Branch: refs/heads/ignite-3484
Commit: c966451d0bf7059575de92bcfae43d72096ebce4
Parents: dd0afb2 dcaf880
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 6 11:27:04 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 6 11:27:04 2017 +0300

----------------------------------------------------------------------
 .../jdbc/thin/JdbcThinStatementSelfTest.java    |  62 ++++-
 .../java/org/apache/ignite/IgniteServices.java  |   2 +-
 .../internal/jdbc/thin/JdbcThinResultSet.java   |  29 ++-
 .../internal/jdbc/thin/JdbcThinStatement.java   |  22 +-
 .../cache/CacheAffinitySharedManager.java       |  17 +-
 .../GridCachePartitionExchangeManager.java      |   5 +-
 .../dht/GridClientPartitionTopology.java        |   3 +
 .../cache/distributed/dht/GridDhtTxLocal.java   |   1 -
 .../GridDhtPartitionsExchangeFuture.java        |  10 +-
 .../odbc/SqlListenerConnectionContext.java      |  37 ++-
 .../processors/odbc/SqlListenerNioListener.java |  95 ++------
 .../odbc/jdbc/JdbcConnectionContext.java        | 101 ++++++++
 .../odbc/odbc/OdbcConnectionContext.java        |  99 ++++++++
 .../odbc/odbc/OdbcRequestHandler.java           |  54 +++--
 .../GridServiceDeploymentCompoundFuture.java    |   1 +
 .../service/GridServiceProcessor.java           |   1 +
 .../service/ServiceDeploymentException.java     |  78 ------
 .../services/ServiceDeploymentException.java    |  77 ++++++
 .../org.apache.ignite.plugin.PluginProvider     |   3 +-
 ...atformCachePluginConfigurationClosureFactory |   1 -
 ...rm.PlatformPluginConfigurationClosureFactory |   1 -
 ...ServiceDeploymentCompoundFutureSelfTest.java |   1 +
 ...GridServiceProcessorBatchDeploySelfTest.java |   1 +
 .../platform/plugin/PlatformTestPlugin.java     |  27 ---
 .../plugin/PlatformTestPluginConfiguration.java |  63 -----
 ...rmTestPluginConfigurationClosureFactory.java |  61 -----
 .../plugin/PlatformTestPluginException.java     |  34 ---
 .../plugin/PlatformTestPluginExtension.java     |  51 ----
 .../plugin/PlatformTestPluginProvider.java      | 103 --------
 .../plugin/PlatformTestPluginTarget.java        | 236 -------------------
 .../cache/PlatformGetCachePluginsTask.java      |  85 -------
 .../PlatformTestCachePluginConfiguration.java   |  55 -----
 ...formTestCachePluginConfigurationClosure.java |  48 ----
 ...tCachePluginConfigurationClosureFactory.java |  37 ---
 .../cache/PlatformTestCachePluginProvider.java  |  72 ------
 modules/extdata/platform/README.txt             |   4 +
 .../extdata/platform/licenses/apache-2.0.txt    | 202 ++++++++++++++++
 modules/extdata/platform/pom.xml                |  46 ++++
 .../platform/plugin/PlatformTestPlugin.java     |  27 +++
 .../plugin/PlatformTestPluginConfiguration.java |  63 +++++
 ...rmTestPluginConfigurationClosureFactory.java |  61 +++++
 .../plugin/PlatformTestPluginException.java     |  34 +++
 .../plugin/PlatformTestPluginExtension.java     |  51 ++++
 .../plugin/PlatformTestPluginProvider.java      | 103 ++++++++
 .../plugin/PlatformTestPluginTarget.java        | 236 +++++++++++++++++++
 .../cache/PlatformGetCachePluginsTask.java      |  85 +++++++
 .../PlatformTestCachePluginConfiguration.java   |  55 +++++
 ...formTestCachePluginConfigurationClosure.java |  48 ++++
 ...tCachePluginConfigurationClosureFactory.java |  37 +++
 .../cache/PlatformTestCachePluginProvider.java  |  72 ++++++
 .../platform/plugin/cache/package-info.java     |  22 ++
 .../ignite/platform/plugin/package-info.java    |  22 ++
 .../org.apache.ignite.plugin.PluginProvider     |   1 +
 ...atformCachePluginConfigurationClosureFactory |   1 +
 ...rm.PlatformPluginConfigurationClosureFactory |   1 +
 .../DynamicIndexAbstractConcurrentSelfTest.java |   2 +-
 .../cpp/odbc-test/src/configuration_test.cpp    |  11 +
 .../include/ignite/odbc/config/configuration.h  |  26 ++
 .../cpp/odbc/include/ignite/odbc/message.h      |   6 +-
 .../odbc/include/ignite/odbc/protocol_version.h |   1 +
 .../odbc/system/ui/dsn_configuration_window.h   |   4 +
 .../src/system/ui/dsn_configuration_window.cpp  |  34 ++-
 .../cpp/odbc/src/config/configuration.cpp       |   2 +
 modules/platforms/cpp/odbc/src/connection.cpp   |   6 +-
 modules/platforms/cpp/odbc/src/dsn_config.cpp   |   3 +
 modules/platforms/cpp/odbc/src/message.cpp      |  15 +-
 .../platforms/cpp/odbc/src/protocol_version.cpp |   8 +-
 .../Apache.Ignite.Core/Impl/Common/Classpath.cs |   1 +
 pom.xml                                         |   1 +
 69 files changed, 1762 insertions(+), 1102 deletions(-)
----------------------------------------------------------------------



[03/14] ignite git commit: Merge remote-tracking branch 'origin/master'

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


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

Branch: refs/heads/ignite-3484
Commit: 8f13169b2e0fb1372b9c20bd84cb8c70142d59ed
Parents: c42a9ea dab2785
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Sep 5 15:01:10 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Sep 5 15:01:10 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/IgniteCacheOffheapManagerImpl.java      | 2 +-
 .../internal/processors/cache/tree/AbstractDataInnerIO.java  | 8 ++++----
 .../internal/processors/cache/tree/AbstractDataLeafIO.java   | 8 ++++----
 .../processors/cache/tree/AbstractPendingEntryInnerIO.java   | 8 ++++----
 .../processors/cache/tree/AbstractPendingEntryLeafIO.java    | 8 ++++----
 .../internal/processors/cache/tree/CacheDataRowStore.java    | 6 +++---
 .../ignite/internal/processors/cache/tree/CacheDataTree.java | 3 ++-
 .../processors/cache/tree/CacheIdAwareDataInnerIO.java       | 4 ++--
 .../processors/cache/tree/CacheIdAwareDataLeafIO.java        | 4 ++--
 .../cache/tree/CacheIdAwarePendingEntryInnerIO.java          | 4 ++--
 .../cache/tree/CacheIdAwarePendingEntryLeafIO.java           | 4 ++--
 .../ignite/internal/processors/cache/tree/DataInnerIO.java   | 8 ++++----
 .../ignite/internal/processors/cache/tree/DataLeafIO.java    | 8 ++++----
 .../ignite/internal/processors/cache/tree/DataRow.java       | 1 +
 .../internal/processors/cache/tree/PendingEntriesTree.java   | 6 +++---
 .../internal/processors/cache/tree/PendingEntryInnerIO.java  | 8 ++++----
 .../internal/processors/cache/tree/PendingEntryLeafIO.java   | 8 ++++----
 .../java/org/apache/ignite/internal/util/lang/GridFunc.java  | 1 +
 18 files changed, 51 insertions(+), 48 deletions(-)
----------------------------------------------------------------------



[02/14] ignite git commit: IGNITE-5879 .NET: Move TestPlatformPlugin to a separate module

Posted by sb...@apache.org.
IGNITE-5879 .NET: Move TestPlatformPlugin to a separate module


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

Branch: refs/heads/ignite-3484
Commit: c42a9eacb1adfd8593702d4d0b76fa5ed14771e8
Parents: 4f80f86
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Tue Sep 5 15:00:21 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Sep 5 15:00:21 2017 +0300

----------------------------------------------------------------------
 .../org.apache.ignite.plugin.PluginProvider     |   3 +-
 ...atformCachePluginConfigurationClosureFactory |   1 -
 ...rm.PlatformPluginConfigurationClosureFactory |   1 -
 .../platform/plugin/PlatformTestPlugin.java     |  27 ---
 .../plugin/PlatformTestPluginConfiguration.java |  63 -----
 ...rmTestPluginConfigurationClosureFactory.java |  61 -----
 .../plugin/PlatformTestPluginException.java     |  34 ---
 .../plugin/PlatformTestPluginExtension.java     |  51 ----
 .../plugin/PlatformTestPluginProvider.java      | 103 --------
 .../plugin/PlatformTestPluginTarget.java        | 236 -------------------
 .../cache/PlatformGetCachePluginsTask.java      |  85 -------
 .../PlatformTestCachePluginConfiguration.java   |  55 -----
 ...formTestCachePluginConfigurationClosure.java |  48 ----
 ...tCachePluginConfigurationClosureFactory.java |  37 ---
 .../cache/PlatformTestCachePluginProvider.java  |  72 ------
 modules/extdata/platform/README.txt             |   4 +
 .../extdata/platform/licenses/apache-2.0.txt    | 202 ++++++++++++++++
 modules/extdata/platform/pom.xml                |  46 ++++
 .../platform/plugin/PlatformTestPlugin.java     |  27 +++
 .../plugin/PlatformTestPluginConfiguration.java |  63 +++++
 ...rmTestPluginConfigurationClosureFactory.java |  61 +++++
 .../plugin/PlatformTestPluginException.java     |  34 +++
 .../plugin/PlatformTestPluginExtension.java     |  51 ++++
 .../plugin/PlatformTestPluginProvider.java      | 103 ++++++++
 .../plugin/PlatformTestPluginTarget.java        | 236 +++++++++++++++++++
 .../cache/PlatformGetCachePluginsTask.java      |  85 +++++++
 .../PlatformTestCachePluginConfiguration.java   |  55 +++++
 ...formTestCachePluginConfigurationClosure.java |  48 ++++
 ...tCachePluginConfigurationClosureFactory.java |  37 +++
 .../cache/PlatformTestCachePluginProvider.java  |  72 ++++++
 .../platform/plugin/cache/package-info.java     |  22 ++
 .../ignite/platform/plugin/package-info.java    |  22 ++
 .../org.apache.ignite.plugin.PluginProvider     |   1 +
 ...atformCachePluginConfigurationClosureFactory |   1 +
 ...rm.PlatformPluginConfigurationClosureFactory |   1 +
 .../Apache.Ignite.Core/Impl/Common/Classpath.cs |   1 +
 pom.xml                                         |   1 +
 37 files changed, 1174 insertions(+), 876 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/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 5b6ed7d..8437ef0 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,3 +1,2 @@
-org.apache.ignite.platform.plugin.PlatformTestPluginProvider
 org.apache.ignite.spi.discovery.tcp.TestReconnectPluginProvider
-org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteStandByClusterTest$StanByClusterTestProvider
\ No newline at end of file
+org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteStandByClusterTest$StanByClusterTestProvider

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory
deleted file mode 100644
index a99b3b9..0000000
--- a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.ignite.platform.plugin.cache.PlatformTestCachePluginConfigurationClosureFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory
deleted file mode 100644
index ef79fbe..0000000
--- a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.ignite.platform.plugin.PlatformTestPluginConfigurationClosureFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
deleted file mode 100644
index b5a2ef3..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
+++ /dev/null
@@ -1,27 +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.platform.plugin;
-
-import org.apache.ignite.plugin.IgnitePlugin;
-
-/**
- * Test plugin.
- */
-class PlatformTestPlugin implements IgnitePlugin {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfiguration.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfiguration.java
deleted file mode 100644
index b7fb36d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfiguration.java
+++ /dev/null
@@ -1,63 +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.platform.plugin;
-
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.plugin.PluginConfiguration;
-
-/**
- * Test plugin configuration.
- */
-public class PlatformTestPluginConfiguration implements PluginConfiguration {
-    /** */
-    private String pluginProperty;
-
-    /**
-     * Initializes a new instance of PlatformTestPluginConfiguration.
-     */
-    public PlatformTestPluginConfiguration() {
-        // No-op.
-    }
-
-    /**
-     * Initializes a new instance of PlatformTestPluginConfiguration.
-     *
-     * @param reader Reader.
-     */
-    public PlatformTestPluginConfiguration(BinaryRawReader reader) {
-        pluginProperty = reader.readString();
-    }
-
-    /**
-     * Gets the plugin property.
-     *
-     * @return Plugin property.
-     */
-    public String pluginProperty() {
-        return pluginProperty;
-    }
-
-    /**
-     * Sets the plugin property.
-     *
-     * @param pluginProperty Value.
-     */
-    public void setPluginProperty(String pluginProperty) {
-        this.pluginProperty = pluginProperty;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfigurationClosureFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfigurationClosureFactory.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfigurationClosureFactory.java
deleted file mode 100644
index e851384..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfigurationClosureFactory.java
+++ /dev/null
@@ -1,61 +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.platform.plugin;
-
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.plugin.PluginConfiguration;
-import org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosure;
-import org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-/**
- * Test config factory.
- */
-public class PlatformTestPluginConfigurationClosureFactory implements PlatformPluginConfigurationClosureFactory,
-        PlatformPluginConfigurationClosure {
-    /** {@inheritDoc} */
-    @Override public int id() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformPluginConfigurationClosure create() {
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void apply(@NotNull IgniteConfiguration cfg, @NotNull BinaryRawReader reader) {
-        ArrayList<PluginConfiguration> cfgs = new ArrayList<>();
-
-        if (cfg.getPluginConfigurations() != null) {
-            Collections.addAll(cfgs, cfg.getPluginConfigurations());
-        }
-
-        PlatformTestPluginConfiguration plugCfg = new PlatformTestPluginConfiguration();
-
-        plugCfg.setPluginProperty(reader.readString());
-
-        cfgs.add(plugCfg);
-
-        cfg.setPluginConfigurations(cfgs.toArray(new PluginConfiguration[cfgs.size()]));
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginException.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginException.java
deleted file mode 100644
index 3d71dda..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginException.java
+++ /dev/null
@@ -1,34 +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.platform.plugin;
-
-import org.apache.ignite.IgniteCheckedException;
-
-/**
- * Custom plugin exception
- */
-public class PlatformTestPluginException extends IgniteCheckedException {
-    /**
-     * Ctor.
-     *
-     * @param msg Message.
-     */
-    public PlatformTestPluginException(String msg) {
-        super(msg);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
deleted file mode 100644
index 597e9bc..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
+++ /dev/null
@@ -1,51 +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.platform.plugin;
-
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.platform.PlatformPluginExtension;
-import org.apache.ignite.internal.processors.platform.PlatformTarget;
-
-/**
- * Test plugin extension.
- */
-public class PlatformTestPluginExtension implements PlatformPluginExtension {
-    /** */
-    private final IgniteEx ignite;
-
-    /**
-     * Ctor.
-     *
-     * @param ignite Ignite.
-     */
-    PlatformTestPluginExtension(IgniteEx ignite) {
-        assert ignite != null;
-
-        this.ignite = ignite;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int id() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformTarget createTarget() {
-        return new PlatformTestPluginTarget(ignite.context().platform().context(), null);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
deleted file mode 100644
index c34696f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
+++ /dev/null
@@ -1,103 +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.platform.plugin;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.platform.PlatformPluginExtension;
-import org.apache.ignite.platform.plugin.cache.PlatformTestCachePluginProvider;
-import org.apache.ignite.plugin.*;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.Serializable;
-import java.util.UUID;
-
-/**
- * Plugin provider for platform tests.
- */
-public class PlatformTestPluginProvider implements PluginProvider<PlatformTestPluginConfiguration> {
-    /** {@inheritDoc} */
-    @Override public String name() {
-        return "TestPlatformPlugin";
-    }
-
-    /** {@inheritDoc} */
-    @Override public String version() {
-        return "1.0";
-    }
-
-    /** {@inheritDoc} */
-    @Override public String copyright() {
-        return "-";
-    }
-
-    /** {@inheritDoc} */
-    @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) {
-        registry.registerExtension(PlatformPluginExtension.class,
-                new PlatformTestPluginExtension((IgniteEx) ctx.grid()));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void start(PluginContext ctx) throws IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void stop(boolean cancel) throws IgniteCheckedException {
-        // No-op.
-    }
-
-    @Override public void onIgniteStart() throws IgniteCheckedException {
-        // No-op.
-    }
-
-    @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 <T> T createComponent(PluginContext ctx, Class<T> cls) {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public <T extends IgnitePlugin> T plugin() {
-        return (T)new PlatformTestPlugin();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CachePluginProvider createCacheProvider(CachePluginContext ctx) {
-        return new PlatformTestCachePluginProvider();
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
deleted file mode 100644
index 8c1cbe9..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
+++ /dev/null
@@ -1,236 +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.platform.plugin;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryRawReaderEx;
-import org.apache.ignite.internal.binary.BinaryRawWriterEx;
-import org.apache.ignite.internal.processors.platform.PlatformAsyncResult;
-import org.apache.ignite.internal.processors.platform.PlatformContext;
-import org.apache.ignite.internal.processors.platform.PlatformTarget;
-import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
-import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
-import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.future.IgniteFutureImpl;
-import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.plugin.PluginConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Test target.
- */
-@SuppressWarnings("ConstantConditions")
-class PlatformTestPluginTarget implements PlatformTarget {
-    /** */
-    private final String name;
-
-    /** */
-    private final PlatformContext platformCtx;
-
-    /**
-     * Constructor.
-     *
-     * @param platformCtx Context.
-     */
-    PlatformTestPluginTarget(PlatformContext platformCtx, String name) {
-        this.platformCtx = platformCtx;
-
-        if (name == null) {
-            // Initialize from configuration.
-            PlatformTestPluginConfiguration cfg = configuration(platformCtx.kernalContext().config());
-
-            assert cfg != null;
-
-            name = cfg.pluginProperty();
-        }
-
-        this.name = name;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException {
-        if (type == -1)
-            throw new PlatformTestPluginException("Baz");
-
-        return val + 1;
-    }
-
-    @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
-        return reader.readString().length();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader, PlatformMemory mem)
-            throws IgniteCheckedException {
-        return processInStreamOutLong(type, reader);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void processInStreamOutStream(int type, BinaryRawReaderEx reader, BinaryRawWriterEx writer)
-            throws IgniteCheckedException {
-        String s = reader.readString();
-
-        writer.writeString(s.toUpperCase());
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformTarget processInStreamOutObject(int type, BinaryRawReaderEx reader)
-            throws IgniteCheckedException {
-        return new PlatformTestPluginTarget(platformCtx, reader.readString());
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformTarget processInObjectStreamOutObjectStream(
-            int type, @Nullable PlatformTarget arg, BinaryRawReaderEx reader, BinaryRawWriterEx writer)
-            throws IgniteCheckedException {
-        PlatformTestPluginTarget t = (PlatformTestPluginTarget)arg;
-
-        writer.writeString(invokeCallback(t.name));
-
-        return new PlatformTestPluginTarget(platformCtx, t.name + reader.readString());
-    }
-
-    /**
-     * Invokes the platform callback.
-     *
-     * @param val Value to send.
-     * @return Result.
-     */
-    private String invokeCallback(String val) {
-        PlatformMemory outMem = platformCtx.memory().allocate();
-        PlatformMemory inMem = platformCtx.memory().allocate();
-
-        PlatformOutputStream outStream = outMem.output();
-        BinaryRawWriterEx writer = platformCtx.writer(outStream);
-
-        writer.writeString(val);
-
-        outStream.synchronize();
-
-        platformCtx.gateway().pluginCallback(1, outMem, inMem);
-
-        BinaryRawReaderEx reader = platformCtx.reader(inMem);
-
-        return reader.readString();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void processOutStream(int type, BinaryRawWriterEx writer) throws IgniteCheckedException {
-        writer.writeString(name);
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformTarget processOutObject(int type) throws IgniteCheckedException {
-        return new PlatformTestPluginTarget(platformCtx, name);
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformAsyncResult processInStreamAsync(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
-        switch (type) {
-            case 1: {
-                // Async upper case.
-                final String val = reader.readString();
-
-                final GridFutureAdapter<String> fa = new GridFutureAdapter<String>() {
-                    @Override public boolean cancel() throws IgniteCheckedException {
-                        return onCancelled();
-                    }
-                };
-
-                new Thread(new Runnable() {
-                    @Override public void run() {
-                        try {
-                            Thread.sleep(500L);
-                            fa.onDone(val.toUpperCase());
-                        } catch (InterruptedException e) {
-                            e.printStackTrace();
-                        }
-                    }
-                }).start();
-
-                return new PlatformAsyncResult() {
-                    @Override public IgniteFuture future() {
-                        //noinspection unchecked
-                        return new IgniteFutureImpl(fa);
-                    }
-
-                    @Override public void write(BinaryRawWriterEx writer, Object result) {
-                        writer.writeString((String) result);
-                    }
-                };
-            }
-            case 2: {
-                // Exception.
-                throw new PlatformTestPluginException("123");
-            }
-            case 3: {
-                // Async exception.
-                final GridFutureAdapter<String> fa = new GridFutureAdapter<>();
-
-                new Thread(new Runnable() {
-                    @Override public void run() {
-                        try {
-                            Thread.sleep(500L);
-                            fa.onDone(new PlatformTestPluginException("x"));
-                        } catch (InterruptedException e) {
-                            e.printStackTrace();
-                        }
-                    }
-                }).start();
-
-                return new PlatformAsyncResult() {
-                    @Override public IgniteFuture future() {
-                        //noinspection unchecked
-                        return new IgniteFutureImpl(fa);
-                    }
-
-                    @Override public void write(BinaryRawWriterEx writer, Object result) {
-                        // No-op.
-                    }
-                };
-            }
-        }
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Exception convertException(Exception e) {
-        return e;
-    }
-
-    /**
-     * Gets the plugin config.
-     *
-     * @param igniteCfg Ignite config.
-     *
-     * @return Plugin config.
-     */
-    private PlatformTestPluginConfiguration configuration(IgniteConfiguration igniteCfg) {
-        if (igniteCfg.getPluginConfigurations() != null) {
-            for (PluginConfiguration pluginCfg : igniteCfg.getPluginConfigurations()) {
-                if (pluginCfg instanceof PlatformTestPluginConfiguration) {
-                    return (PlatformTestPluginConfiguration) pluginCfg;
-                }
-            }
-        }
-
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformGetCachePluginsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformGetCachePluginsTask.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformGetCachePluginsTask.java
deleted file mode 100644
index cfcf0d5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformGetCachePluginsTask.java
+++ /dev/null
@@ -1,85 +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.platform.plugin.cache;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.plugin.CachePluginConfiguration;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Task to get a list of cache plugins.
- */
-public class PlatformGetCachePluginsTask extends ComputeTaskAdapter<String, String[]> {
-    /** {@inheritDoc} */
-    @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
-        @Nullable String arg) {
-        return Collections.singletonMap(new GetCachePluginsJob(arg), F.first(subgrid));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public String[] reduce(List<ComputeJobResult> results) {
-        return results.get(0).getData();
-    }
-
-    /**
-     * Job.
-     */
-    @SuppressWarnings("unchecked")
-    private static class GetCachePluginsJob extends ComputeJobAdapter {
-        /** */
-        private final String cacheName;
-
-        /** */
-        @IgniteInstanceResource
-        private final Ignite ignite;
-
-        /** */
-        GetCachePluginsJob(String cacheName) {
-            this.cacheName = cacheName;
-            ignite = null;
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public String[] execute() {
-            CachePluginConfiguration[] cfg =
-                    ignite.cache(cacheName).getConfiguration(CacheConfiguration.class).getPluginConfigurations();
-
-            if (cfg == null)
-                return null;
-
-            String[] res = new String[cfg.length];
-
-            for (int i = 0; i < cfg.length; i++)
-                res[i] = cfg[i].getClass().getName();
-
-            return res;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfiguration.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfiguration.java
deleted file mode 100644
index 9f1db88..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfiguration.java
+++ /dev/null
@@ -1,55 +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.platform.plugin.cache;
-
-import org.apache.ignite.plugin.CachePluginConfiguration;
-import org.apache.ignite.plugin.CachePluginContext;
-import org.apache.ignite.plugin.CachePluginProvider;
-
-/**
- * Test plugin configuration.
- */
-public class PlatformTestCachePluginConfiguration implements CachePluginConfiguration {
-    /** */
-    private String pluginProperty;
-
-    /**
-     * Initializes a new instance of PlatformTestPluginConfiguration.
-     */
-    PlatformTestCachePluginConfiguration() {
-        // No-op.
-    }
-
-    /**
-     * Gets the plugin property.
-     *
-     * @return Plugin property.
-     */
-    public String pluginProperty() {
-        return pluginProperty;
-    }
-
-    /**
-     * Sets the plugin property.
-     *
-     * @param pluginProperty Value.
-     */
-    void setPluginProperty(String pluginProperty) {
-        this.pluginProperty = pluginProperty;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosure.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosure.java
deleted file mode 100644
index 2763c4f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosure.java
+++ /dev/null
@@ -1,48 +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.platform.plugin.cache;
-
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.plugin.CachePluginConfiguration;
-import org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosure;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-/**
- * Test config closure.
- */
-public class PlatformTestCachePluginConfigurationClosure implements PlatformCachePluginConfigurationClosure {
-    /** {@inheritDoc} */
-    @Override public void apply(CacheConfiguration cacheConfiguration, BinaryRawReader reader) {
-        ArrayList<CachePluginConfiguration> cfgs = new ArrayList<>();
-
-        if (cacheConfiguration.getPluginConfigurations() != null) {
-            Collections.addAll(cfgs, cacheConfiguration.getPluginConfigurations());
-        }
-
-        PlatformTestCachePluginConfiguration plugCfg = new PlatformTestCachePluginConfiguration();
-
-        plugCfg.setPluginProperty(reader.readString());
-
-        cfgs.add(plugCfg);
-
-        cacheConfiguration.setPluginConfigurations(cfgs.toArray(new CachePluginConfiguration[cfgs.size()]));
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosureFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosureFactory.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosureFactory.java
deleted file mode 100644
index c294342..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfigurationClosureFactory.java
+++ /dev/null
@@ -1,37 +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.platform.plugin.cache;
-
-import org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosure;
-import org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosureFactory;
-
-/**
- * Test closure factory.
- */
-public class PlatformTestCachePluginConfigurationClosureFactory
-    implements PlatformCachePluginConfigurationClosureFactory {
-    /** {@inheritDoc} */
-    @Override public int id() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformCachePluginConfigurationClosure create() {
-        return new PlatformTestCachePluginConfigurationClosure();
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginProvider.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginProvider.java
deleted file mode 100644
index ba04411..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginProvider.java
+++ /dev/null
@@ -1,72 +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.platform.plugin.cache;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.plugin.CachePluginConfiguration;
-import org.apache.ignite.plugin.CachePluginProvider;
-import org.jetbrains.annotations.Nullable;
-
-import javax.cache.Cache;
-
-/**
- * Test cache plugin provider.
- */
-public class PlatformTestCachePluginProvider implements CachePluginProvider {
-    /** {@inheritDoc} */
-    @Override public void start() throws IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void stop(boolean cancel) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onIgniteStart() throws IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onIgniteStop(boolean cancel) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void validate() throws IgniteCheckedException {
-        // No-op.
-    }
-
-    @Override public void validateRemote(CacheConfiguration locCfg, CacheConfiguration rmtCfg, ClusterNode rmtNode)
-        throws IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object unwrapCacheEntry(Cache.Entry entry, Class cls) {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object createComponent(Class cls) {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/README.txt
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/README.txt b/modules/extdata/platform/README.txt
new file mode 100644
index 0000000..cb583ca
--- /dev/null
+++ b/modules/extdata/platform/README.txt
@@ -0,0 +1,4 @@
+Apache Ignite Platform Tests
+------------------------
+
+Special module for platform tests.

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/licenses/apache-2.0.txt b/modules/extdata/platform/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/extdata/platform/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/c42a9eac/modules/extdata/platform/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/pom.xml b/modules/extdata/platform/pom.xml
new file mode 100644
index 0000000..d7b84ac
--- /dev/null
+++ b/modules/extdata/platform/pom.xml
@@ -0,0 +1,46 @@
+<?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-extdata-platform</artifactId>
+    <version>2.2.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
new file mode 100644
index 0000000..b5a2ef3
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
@@ -0,0 +1,27 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.plugin.IgnitePlugin;
+
+/**
+ * Test plugin.
+ */
+class PlatformTestPlugin implements IgnitePlugin {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfiguration.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfiguration.java
new file mode 100644
index 0000000..b7fb36d
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfiguration.java
@@ -0,0 +1,63 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.plugin.PluginConfiguration;
+
+/**
+ * Test plugin configuration.
+ */
+public class PlatformTestPluginConfiguration implements PluginConfiguration {
+    /** */
+    private String pluginProperty;
+
+    /**
+     * Initializes a new instance of PlatformTestPluginConfiguration.
+     */
+    public PlatformTestPluginConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Initializes a new instance of PlatformTestPluginConfiguration.
+     *
+     * @param reader Reader.
+     */
+    public PlatformTestPluginConfiguration(BinaryRawReader reader) {
+        pluginProperty = reader.readString();
+    }
+
+    /**
+     * Gets the plugin property.
+     *
+     * @return Plugin property.
+     */
+    public String pluginProperty() {
+        return pluginProperty;
+    }
+
+    /**
+     * Sets the plugin property.
+     *
+     * @param pluginProperty Value.
+     */
+    public void setPluginProperty(String pluginProperty) {
+        this.pluginProperty = pluginProperty;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfigurationClosureFactory.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfigurationClosureFactory.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfigurationClosureFactory.java
new file mode 100644
index 0000000..e851384
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginConfigurationClosureFactory.java
@@ -0,0 +1,61 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosure;
+import org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * Test config factory.
+ */
+public class PlatformTestPluginConfigurationClosureFactory implements PlatformPluginConfigurationClosureFactory,
+        PlatformPluginConfigurationClosure {
+    /** {@inheritDoc} */
+    @Override public int id() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public PlatformPluginConfigurationClosure create() {
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void apply(@NotNull IgniteConfiguration cfg, @NotNull BinaryRawReader reader) {
+        ArrayList<PluginConfiguration> cfgs = new ArrayList<>();
+
+        if (cfg.getPluginConfigurations() != null) {
+            Collections.addAll(cfgs, cfg.getPluginConfigurations());
+        }
+
+        PlatformTestPluginConfiguration plugCfg = new PlatformTestPluginConfiguration();
+
+        plugCfg.setPluginProperty(reader.readString());
+
+        cfgs.add(plugCfg);
+
+        cfg.setPluginConfigurations(cfgs.toArray(new PluginConfiguration[cfgs.size()]));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginException.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginException.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginException.java
new file mode 100644
index 0000000..3d71dda
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginException.java
@@ -0,0 +1,34 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.IgniteCheckedException;
+
+/**
+ * Custom plugin exception
+ */
+public class PlatformTestPluginException extends IgniteCheckedException {
+    /**
+     * Ctor.
+     *
+     * @param msg Message.
+     */
+    public PlatformTestPluginException(String msg) {
+        super(msg);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
new file mode 100644
index 0000000..597e9bc
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
@@ -0,0 +1,51 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.platform.PlatformPluginExtension;
+import org.apache.ignite.internal.processors.platform.PlatformTarget;
+
+/**
+ * Test plugin extension.
+ */
+public class PlatformTestPluginExtension implements PlatformPluginExtension {
+    /** */
+    private final IgniteEx ignite;
+
+    /**
+     * Ctor.
+     *
+     * @param ignite Ignite.
+     */
+    PlatformTestPluginExtension(IgniteEx ignite) {
+        assert ignite != null;
+
+        this.ignite = ignite;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int id() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public PlatformTarget createTarget() {
+        return new PlatformTestPluginTarget(ignite.context().platform().context(), null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
new file mode 100644
index 0000000..c34696f
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
@@ -0,0 +1,103 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.platform.PlatformPluginExtension;
+import org.apache.ignite.platform.plugin.cache.PlatformTestCachePluginProvider;
+import org.apache.ignite.plugin.*;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+/**
+ * Plugin provider for platform tests.
+ */
+public class PlatformTestPluginProvider implements PluginProvider<PlatformTestPluginConfiguration> {
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "TestPlatformPlugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String version() {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String copyright() {
+        return "-";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) {
+        registry.registerExtension(PlatformPluginExtension.class,
+                new PlatformTestPluginExtension((IgniteEx) ctx.grid()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext ctx) throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean cancel) throws IgniteCheckedException {
+        // No-op.
+    }
+
+    @Override public void onIgniteStart() throws IgniteCheckedException {
+        // No-op.
+    }
+
+    @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 <T> T createComponent(PluginContext ctx, Class<T> cls) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T extends IgnitePlugin> T plugin() {
+        return (T)new PlatformTestPlugin();
+    }
+
+    /** {@inheritDoc} */
+    @Override public CachePluginProvider createCacheProvider(CachePluginContext ctx) {
+        return new PlatformTestCachePluginProvider();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
new file mode 100644
index 0000000..8c1cbe9
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
@@ -0,0 +1,236 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.binary.BinaryRawWriterEx;
+import org.apache.ignite.internal.processors.platform.PlatformAsyncResult;
+import org.apache.ignite.internal.processors.platform.PlatformContext;
+import org.apache.ignite.internal.processors.platform.PlatformTarget;
+import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
+import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.plugin.PluginConfiguration;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Test target.
+ */
+@SuppressWarnings("ConstantConditions")
+class PlatformTestPluginTarget implements PlatformTarget {
+    /** */
+    private final String name;
+
+    /** */
+    private final PlatformContext platformCtx;
+
+    /**
+     * Constructor.
+     *
+     * @param platformCtx Context.
+     */
+    PlatformTestPluginTarget(PlatformContext platformCtx, String name) {
+        this.platformCtx = platformCtx;
+
+        if (name == null) {
+            // Initialize from configuration.
+            PlatformTestPluginConfiguration cfg = configuration(platformCtx.kernalContext().config());
+
+            assert cfg != null;
+
+            name = cfg.pluginProperty();
+        }
+
+        this.name = name;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException {
+        if (type == -1)
+            throw new PlatformTestPluginException("Baz");
+
+        return val + 1;
+    }
+
+    @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
+        return reader.readString().length();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader, PlatformMemory mem)
+            throws IgniteCheckedException {
+        return processInStreamOutLong(type, reader);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void processInStreamOutStream(int type, BinaryRawReaderEx reader, BinaryRawWriterEx writer)
+            throws IgniteCheckedException {
+        String s = reader.readString();
+
+        writer.writeString(s.toUpperCase());
+    }
+
+    /** {@inheritDoc} */
+    @Override public PlatformTarget processInStreamOutObject(int type, BinaryRawReaderEx reader)
+            throws IgniteCheckedException {
+        return new PlatformTestPluginTarget(platformCtx, reader.readString());
+    }
+
+    /** {@inheritDoc} */
+    @Override public PlatformTarget processInObjectStreamOutObjectStream(
+            int type, @Nullable PlatformTarget arg, BinaryRawReaderEx reader, BinaryRawWriterEx writer)
+            throws IgniteCheckedException {
+        PlatformTestPluginTarget t = (PlatformTestPluginTarget)arg;
+
+        writer.writeString(invokeCallback(t.name));
+
+        return new PlatformTestPluginTarget(platformCtx, t.name + reader.readString());
+    }
+
+    /**
+     * Invokes the platform callback.
+     *
+     * @param val Value to send.
+     * @return Result.
+     */
+    private String invokeCallback(String val) {
+        PlatformMemory outMem = platformCtx.memory().allocate();
+        PlatformMemory inMem = platformCtx.memory().allocate();
+
+        PlatformOutputStream outStream = outMem.output();
+        BinaryRawWriterEx writer = platformCtx.writer(outStream);
+
+        writer.writeString(val);
+
+        outStream.synchronize();
+
+        platformCtx.gateway().pluginCallback(1, outMem, inMem);
+
+        BinaryRawReaderEx reader = platformCtx.reader(inMem);
+
+        return reader.readString();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void processOutStream(int type, BinaryRawWriterEx writer) throws IgniteCheckedException {
+        writer.writeString(name);
+    }
+
+    /** {@inheritDoc} */
+    @Override public PlatformTarget processOutObject(int type) throws IgniteCheckedException {
+        return new PlatformTestPluginTarget(platformCtx, name);
+    }
+
+    /** {@inheritDoc} */
+    @Override public PlatformAsyncResult processInStreamAsync(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
+        switch (type) {
+            case 1: {
+                // Async upper case.
+                final String val = reader.readString();
+
+                final GridFutureAdapter<String> fa = new GridFutureAdapter<String>() {
+                    @Override public boolean cancel() throws IgniteCheckedException {
+                        return onCancelled();
+                    }
+                };
+
+                new Thread(new Runnable() {
+                    @Override public void run() {
+                        try {
+                            Thread.sleep(500L);
+                            fa.onDone(val.toUpperCase());
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }).start();
+
+                return new PlatformAsyncResult() {
+                    @Override public IgniteFuture future() {
+                        //noinspection unchecked
+                        return new IgniteFutureImpl(fa);
+                    }
+
+                    @Override public void write(BinaryRawWriterEx writer, Object result) {
+                        writer.writeString((String) result);
+                    }
+                };
+            }
+            case 2: {
+                // Exception.
+                throw new PlatformTestPluginException("123");
+            }
+            case 3: {
+                // Async exception.
+                final GridFutureAdapter<String> fa = new GridFutureAdapter<>();
+
+                new Thread(new Runnable() {
+                    @Override public void run() {
+                        try {
+                            Thread.sleep(500L);
+                            fa.onDone(new PlatformTestPluginException("x"));
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }).start();
+
+                return new PlatformAsyncResult() {
+                    @Override public IgniteFuture future() {
+                        //noinspection unchecked
+                        return new IgniteFutureImpl(fa);
+                    }
+
+                    @Override public void write(BinaryRawWriterEx writer, Object result) {
+                        // No-op.
+                    }
+                };
+            }
+        }
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Exception convertException(Exception e) {
+        return e;
+    }
+
+    /**
+     * Gets the plugin config.
+     *
+     * @param igniteCfg Ignite config.
+     *
+     * @return Plugin config.
+     */
+    private PlatformTestPluginConfiguration configuration(IgniteConfiguration igniteCfg) {
+        if (igniteCfg.getPluginConfigurations() != null) {
+            for (PluginConfiguration pluginCfg : igniteCfg.getPluginConfigurations()) {
+                if (pluginCfg instanceof PlatformTestPluginConfiguration) {
+                    return (PlatformTestPluginConfiguration) pluginCfg;
+                }
+            }
+        }
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformGetCachePluginsTask.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformGetCachePluginsTask.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformGetCachePluginsTask.java
new file mode 100644
index 0000000..cfcf0d5
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformGetCachePluginsTask.java
@@ -0,0 +1,85 @@
+/*
+ * 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.platform.plugin.cache;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.CachePluginConfiguration;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Task to get a list of cache plugins.
+ */
+public class PlatformGetCachePluginsTask extends ComputeTaskAdapter<String, String[]> {
+    /** {@inheritDoc} */
+    @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+        @Nullable String arg) {
+        return Collections.singletonMap(new GetCachePluginsJob(arg), F.first(subgrid));
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public String[] reduce(List<ComputeJobResult> results) {
+        return results.get(0).getData();
+    }
+
+    /**
+     * Job.
+     */
+    @SuppressWarnings("unchecked")
+    private static class GetCachePluginsJob extends ComputeJobAdapter {
+        /** */
+        private final String cacheName;
+
+        /** */
+        @IgniteInstanceResource
+        private final Ignite ignite;
+
+        /** */
+        GetCachePluginsJob(String cacheName) {
+            this.cacheName = cacheName;
+            ignite = null;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public String[] execute() {
+            CachePluginConfiguration[] cfg =
+                    ignite.cache(cacheName).getConfiguration(CacheConfiguration.class).getPluginConfigurations();
+
+            if (cfg == null)
+                return null;
+
+            String[] res = new String[cfg.length];
+
+            for (int i = 0; i < cfg.length; i++)
+                res[i] = cfg[i].getClass().getName();
+
+            return res;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c42a9eac/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfiguration.java b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfiguration.java
new file mode 100644
index 0000000..9f1db88
--- /dev/null
+++ b/modules/extdata/platform/src/test/java/org/apache/ignite/platform/plugin/cache/PlatformTestCachePluginConfiguration.java
@@ -0,0 +1,55 @@
+/*
+ * 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.platform.plugin.cache;
+
+import org.apache.ignite.plugin.CachePluginConfiguration;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+
+/**
+ * Test plugin configuration.
+ */
+public class PlatformTestCachePluginConfiguration implements CachePluginConfiguration {
+    /** */
+    private String pluginProperty;
+
+    /**
+     * Initializes a new instance of PlatformTestPluginConfiguration.
+     */
+    PlatformTestCachePluginConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Gets the plugin property.
+     *
+     * @return Plugin property.
+     */
+    public String pluginProperty() {
+        return pluginProperty;
+    }
+
+    /**
+     * Sets the plugin property.
+     *
+     * @param pluginProperty Value.
+     */
+    void setPluginProperty(String pluginProperty) {
+        this.pluginProperty = pluginProperty;
+    }
+}


[08/14] ignite git commit: IGNITE-6179: Improved reliability of DynamicIndexAbstractConcurrentSelfTest.testClientReconnectWithCacheRestart. This closes #2596.

Posted by sb...@apache.org.
IGNITE-6179: Improved reliability of DynamicIndexAbstractConcurrentSelfTest.testClientReconnectWithCacheRestart. This closes #2596.


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

Branch: refs/heads/ignite-3484
Commit: 1202f3f57ae3de670108e9f08ca5b1b0ca1c7499
Parents: 3a91757
Author: vk <ka...@gmail.com>
Authored: Wed Sep 6 10:41:16 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Wed Sep 6 10:41:16 2017 +0300

----------------------------------------------------------------------
 .../cache/index/DynamicIndexAbstractConcurrentSelfTest.java        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1202f3f5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
index 7b53f73..3190b5e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
@@ -699,7 +699,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
 
                 final QueryIndex idx = index(IDX_NAME_2, field(FIELD_NAME_1), field(aliasUnescaped(FIELD_NAME_2)));
 
-                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
+                queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false).get();
             }
         });
 


[10/14] ignite git commit: Cleanup DiscoCache.

Posted by sb...@apache.org.
Cleanup DiscoCache.


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

Branch: refs/heads/ignite-3484
Commit: 788adc0d00e0455e06cc9acabfe9ad425fdcd65b
Parents: 1202f3f
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 6 11:14:21 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 6 11:14:21 2017 +0300

----------------------------------------------------------------------
 .../internal/managers/discovery/DiscoCache.java |  62 +--
 .../discovery/GridDiscoveryManager.java         |  38 +-
 .../cache/CacheAffinitySharedManager.java       |  17 +-
 .../GridCachePartitionExchangeManager.java      |   9 +-
 .../processors/cache/GridCacheUtils.java        |  53 +--
 .../dht/GridClientPartitionTopology.java        |  11 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |   6 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |  48 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java | 440 +++++++++----------
 .../dht/atomic/GridDhtAtomicCache.java          |   2 +-
 .../dht/colocated/GridDhtColocatedCache.java    |   4 +-
 .../GridDhtPartitionsExchangeFuture.java        |  12 +-
 .../near/GridNearTransactionalCache.java        |   4 +-
 .../cache/distributed/near/GridNearTxLocal.java |  20 +-
 .../cache/query/GridCacheQueryAdapter.java      |   2 +-
 .../cache/query/GridCacheQueryManager.java      |   6 +-
 .../cache/transactions/IgniteTxHandler.java     |  15 +-
 .../service/GridServiceProcessor.java           |   4 +-
 .../CacheLateAffinityAssignmentTest.java        |   2 +-
 19 files changed, 302 insertions(+), 453 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
index 5ac99f1..4b57eb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
@@ -58,13 +58,6 @@ public class DiscoCache {
     /** Daemon nodes. */
     private final List<ClusterNode> daemonNodes;
 
-    /** All server nodes. */
-    private final List<ClusterNode> srvNodesWithCaches;
-
-    /** All nodes with at least one cache configured. */
-    @GridToStringInclude
-    private final List<ClusterNode> allNodesWithCaches;
-
     /** All remote nodes with at least one cache configured. */
     @GridToStringInclude
     private final List<ClusterNode> rmtNodesWithCaches;
@@ -97,8 +90,6 @@ public class DiscoCache {
      * @param allNodes All nodes.
      * @param srvNodes Server nodes.
      * @param daemonNodes Daemon nodes.
-     * @param srvNodesWithCaches Server nodes with at least one cache configured.
-     * @param allNodesWithCaches All nodes with at least one cache configured.
      * @param rmtNodesWithCaches Remote nodes with at least one cache configured.
      * @param allCacheNodes Cache nodes by cache name.
      * @param cacheGrpAffNodes Affinity nodes by cache group ID.
@@ -113,8 +104,6 @@ public class DiscoCache {
         List<ClusterNode> allNodes,
         List<ClusterNode> srvNodes,
         List<ClusterNode> daemonNodes,
-        List<ClusterNode> srvNodesWithCaches,
-        List<ClusterNode> allNodesWithCaches,
         List<ClusterNode> rmtNodesWithCaches,
         Map<Integer, List<ClusterNode>> allCacheNodes,
         Map<Integer, List<ClusterNode>> cacheGrpAffNodes,
@@ -127,8 +116,6 @@ public class DiscoCache {
         this.allNodes = allNodes;
         this.srvNodes = srvNodes;
         this.daemonNodes = daemonNodes;
-        this.srvNodesWithCaches = srvNodesWithCaches;
-        this.allNodesWithCaches = allNodesWithCaches;
         this.rmtNodesWithCaches = rmtNodesWithCaches;
         this.allCacheNodes = allCacheNodes;
         this.cacheGrpAffNodes = cacheGrpAffNodes;
@@ -195,36 +182,13 @@ public class DiscoCache {
         return daemonNodes;
     }
 
-    /** @return Server nodes with at least one cache configured. */
-    public List<ClusterNode> serverNodesWithCaches() {
-        return srvNodesWithCaches;
-    }
-
     /**
-     * Gets all remote nodes that have at least one cache configured.
+     * Gets all alive remote nodes that have at least one cache configured.
      *
      * @return Collection of nodes.
      */
-    public List<ClusterNode> remoteNodesWithCaches() {
-        return rmtNodesWithCaches;
-    }
-
-    /**
-     * Gets collection of nodes with at least one cache configured.
-     *
-     * @return Collection of nodes.
-     */
-    public List<ClusterNode> allNodesWithCaches() {
-        return allNodesWithCaches;
-    }
-
-    /**
-     * Gets collection of server nodes with at least one cache configured.
-     *
-     * @return Collection of nodes.
-     */
-    public Collection<ClusterNode> aliveServerNodes() {
-        return F.view(serverNodes(), new P1<ClusterNode>() {
+    public Collection<ClusterNode> remoteAliveNodesWithCaches() {
+        return F.view(rmtNodesWithCaches, new P1<ClusterNode>() {
             @Override public boolean apply(ClusterNode node) {
                 return alives.contains(node.id());
             }
@@ -236,8 +200,8 @@ public class DiscoCache {
      *
      * @return Collection of nodes.
      */
-    public Collection<ClusterNode> aliveServerNodesWithCaches() {
-        return F.view(serverNodesWithCaches(), new P1<ClusterNode>() {
+    public Collection<ClusterNode> aliveServerNodes() {
+        return F.view(serverNodes(), new P1<ClusterNode>() {
             @Override public boolean apply(ClusterNode node) {
                 return alives.contains(node.id());
             }
@@ -248,16 +212,14 @@ public class DiscoCache {
      * @return Oldest alive server node.
      */
     public @Nullable ClusterNode oldestAliveServerNode(){
-        Iterator<ClusterNode> it = aliveServerNodes().iterator();
-        return it.hasNext() ? it.next() : null;
-    }
+        for (int i = 0; i < srvNodes.size(); i++) {
+            ClusterNode srv = srvNodes.get(i);
 
-    /**
-     * @return Oldest alive server node with at least one cache configured.
-     */
-    public @Nullable ClusterNode oldestAliveServerNodeWithCache(){
-        Iterator<ClusterNode> it = aliveServerNodesWithCaches().iterator();
-        return it.hasNext() ? it.next() : null;
+            if (alives.contains(srv.id()))
+                return srv;
+        }
+
+        return null;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 56af9bf..fa5d053 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -1845,42 +1845,21 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
     }
 
     /**
-     * Gets cache nodes for cache with given ID.
-     *
-     * @param cacheId Cache ID.
-     * @param topVer Topology version.
-     * @return Collection of cache nodes.
-     */
-    public Collection<ClusterNode> cacheNodes(int cacheId, AffinityTopologyVersion topVer) {
-        return resolveDiscoCache(cacheId, topVer).cacheNodes(cacheId);
-    }
-
-    /**
-     * Gets all nodes with at least one cache configured.
-     *
-     * @param topVer Topology version.
-     * @return Collection of cache nodes.
-     */
-    public Collection<ClusterNode> cacheNodes(AffinityTopologyVersion topVer) {
-        return resolveDiscoCache(CU.cacheId(null), topVer).allNodesWithCaches();
-    }
-
-    /**
      * Gets cache remote nodes for cache with given name.
      *
      * @param topVer Topology version.
      * @return Collection of cache nodes.
      */
-    public Collection<ClusterNode> remoteCacheNodes(AffinityTopologyVersion topVer) {
-        return resolveDiscoCache(CU.cacheId(null), topVer).remoteNodesWithCaches();
+    public Collection<ClusterNode> remoteAliveNodesWithCaches(AffinityTopologyVersion topVer) {
+        return resolveDiscoCache(CU.cacheId(null), topVer).remoteAliveNodesWithCaches();
     }
 
     /**
      * @param topVer Topology version (maximum allowed node order).
      * @return Oldest alive server nodes with at least one cache configured.
      */
-    @Nullable public ClusterNode oldestAliveCacheServerNode(AffinityTopologyVersion topVer) {
-        return resolveDiscoCache(CU.cacheId(null), topVer).oldestAliveServerNodeWithCache();
+    @Nullable public ClusterNode oldestAliveServerNode(AffinityTopologyVersion topVer) {
+        return resolveDiscoCache(CU.cacheId(null), topVer).oldestAliveServerNode();
     }
 
     /**
@@ -2243,9 +2222,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
         Map<Integer, List<ClusterNode>> allCacheNodes = U.newHashMap(allNodes.size());
         Map<Integer, List<ClusterNode>> cacheGrpAffNodes = U.newHashMap(allNodes.size());
 
-        Set<ClusterNode> allNodesWithCaches = new TreeSet<>(GridNodeOrderComparator.INSTANCE);
         Set<ClusterNode> rmtNodesWithCaches = new TreeSet<>(GridNodeOrderComparator.INSTANCE);
-        Set<ClusterNode> srvNodesWithCaches = new TreeSet<>(GridNodeOrderComparator.INSTANCE);
 
         for (ClusterNode node : allNodes) {
             assert node.order() != 0 : "Invalid node order [locNode=" + loc + ", node=" + node + ']';
@@ -2270,11 +2247,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
                 CachePredicate filter = entry.getValue();
 
                 if (filter.cacheNode(node)) {
-                    allNodesWithCaches.add(node);
-
-                    if(!CU.clientNode(node))
-                        srvNodesWithCaches.add(node);
-
                     if (!node.isLocal())
                         rmtNodesWithCaches.add(node);
 
@@ -2291,8 +2263,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
             Collections.unmodifiableList(allNodes),
             Collections.unmodifiableList(srvNodes),
             Collections.unmodifiableList(daemonNodes),
-            U.sealList(srvNodesWithCaches),
-            U.sealList(allNodesWithCaches),
             U.sealList(rmtNodesWithCaches),
             Collections.unmodifiableMap(allCacheNodes),
             Collections.unmodifiableMap(cacheGrpAffNodes),

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 39a5ea8..beb7a7d 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
@@ -1659,7 +1659,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                         if (!aff.lastVersion().equals(topVer))
                             calculateAndInit(fut.events(), aff, topVer);
 
-                        grpHolder.topology().beforeExchange(fut, true, false);
+                        grpHolder.topology(fut.context().events().discoveryCache()).beforeExchange(fut, true, false);
                     }
                     else {
                         List<GridDhtPartitionsExchangeFuture> exchFuts = cctx.exchange().exchangeFutures();
@@ -1715,7 +1715,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                         if (!aff.lastVersion().equals(topVer))
                             calculateAndInit(fut.events(), aff, topVer);
 
-                        grpHolder.topology().beforeExchange(fut, true, false);
+                        grpHolder.topology(fut.context().events().discoveryCache()).beforeExchange(fut, true, false);
                     }
                 }
 
@@ -1833,7 +1833,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                         Map<UUID, GridDhtPartitionMap> map = affinityFullMap(aff);
 
                         for (GridDhtPartitionMap map0 : map.values())
-                            cache.topology().update(fut.exchangeId(), map0, true);
+                            cache.topology(fut.context().events().discoveryCache()).update(fut.exchangeId(), map0, true);
                     }
                 }
             });
@@ -2059,7 +2059,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
 
                 List<List<ClusterNode>> newAssignment0 = initAff ? new ArrayList<>(newAssignment) : null;
 
-                GridDhtPartitionTopology top = grpHolder.topology();
+                GridDhtPartitionTopology top = grpHolder.topology(fut.context().events().discoveryCache());
 
                 Map<Integer, List<T>> cacheAssignment = null;
 
@@ -2277,9 +2277,10 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
         }
 
         /**
+         * @param discoCache Discovery data cache.
          * @return Cache topology.
          */
-        abstract GridDhtPartitionTopology topology();
+        abstract GridDhtPartitionTopology topology(DiscoCache discoCache);
 
         /**
          * @return Affinity.
@@ -2314,7 +2315,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
         }
 
         /** {@inheritDoc} */
-        @Override public GridDhtPartitionTopology topology() {
+        @Override public GridDhtPartitionTopology topology(DiscoCache discoCache) {
             return grp.topology();
         }
     }
@@ -2390,8 +2391,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
         }
 
         /** {@inheritDoc} */
-        @Override public GridDhtPartitionTopology topology() {
-            return cctx.exchange().clientTopology(groupId());
+        @Override public GridDhtPartitionTopology topology(DiscoCache discoCache) {
+            return cctx.exchange().clientTopology(groupId(), discoCache);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index bd34a5f..fe9ed29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -719,9 +719,10 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
     /**
      * @param grpId Cache group ID.
+     * @param discoCache Discovery data cache.
      * @return Topology.
      */
-    public GridDhtPartitionTopology clientTopology(int grpId) {
+    public GridDhtPartitionTopology clientTopology(int grpId, DiscoCache discoCache) {
         GridClientPartitionTopology top = clientTops.get(grpId);
 
         if (top != null)
@@ -741,7 +742,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
             aff.partitions());
 
         GridClientPartitionTopology old = clientTops.putIfAbsent(grpId,
-            top = new GridClientPartitionTopology(cctx, grpId, aff.partitions(), affKey));
+            top = new GridClientPartitionTopology(cctx, discoCache, grpId, aff.partitions(), affKey));
 
         return old != null ? old : top;
     }
@@ -925,7 +926,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
      * for non coordinator -  {@link GridDhtPartitionsSingleMessage SingleMessages} send
      */
     private void refreshPartitions() {
-        ClusterNode oldest = cctx.discovery().oldestAliveCacheServerNode(AffinityTopologyVersion.NONE);
+        ClusterNode oldest = cctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE);
 
         if (oldest == null) {
             if (log.isDebugEnabled())
@@ -955,7 +956,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
             AffinityTopologyVersion rmtTopVer =
                 lastFut != null ? (lastFut.isDone() ? lastFut.topologyVersion() : lastFut.initialVersion()) : AffinityTopologyVersion.NONE;
 
-            Collection<ClusterNode> rmts = CU.remoteNodes(cctx, rmtTopVer);
+            Collection<ClusterNode> rmts = cctx.discovery().remoteAliveNodesWithCaches(rmtTopVer);
 
             if (log.isDebugEnabled())
                 log.debug("Refreshing partitions from oldest node: " + cctx.localNodeId());

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 070fc81..2018a64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -441,59 +441,14 @@ public class GridCacheUtils {
     }
 
     /**
-     * Gets all nodes on which cache with the same name is started.
-     *
-     * @param ctx Cache context.
-     * @param topOrder Maximum allowed node order.
-     * @return All nodes on which cache with the same name is started (including nodes
-     *      that may have already left).
-     */
-    public static Collection<ClusterNode> allNodes(GridCacheContext ctx, AffinityTopologyVersion topOrder) {
-        return ctx.discovery().cacheNodes(ctx.cacheId(), topOrder);
-    }
-
-    /**
-     * Gets all nodes with at least one cache configured.
-     *
-     * @param ctx Shared cache context.
-     * @param topOrder Maximum allowed node order.
-     * @return All nodes on which cache with the same name is started (including nodes
-     *      that may have already left).
-     */
-    public static Collection<ClusterNode> allNodes(GridCacheSharedContext ctx, AffinityTopologyVersion topOrder) {
-        return ctx.discovery().cacheNodes(topOrder);
-    }
-
-    /**
-     * Gets remote nodes with at least one cache configured.
-     *
-     * @param ctx Cache shared context.
-     * @param topVer Topology version.
-     * @return Collection of remote nodes with at least one cache configured.
-     */
-    public static Collection<ClusterNode> remoteNodes(final GridCacheSharedContext ctx, AffinityTopologyVersion topVer) {
-        return ctx.discovery().remoteCacheNodes(topVer);
-    }
-
-    /**
-     * Gets all nodes on which cache with the same name is started and the local DHT storage is enabled.
-     *
-     * @param ctx Cache context.
-     * @return All nodes on which cache with the same name is started.
-     */
-    public static Collection<ClusterNode> affinityNodes(final GridCacheContext ctx) {
-        return ctx.discovery().cacheGroupAffinityNodes(ctx.groupId(), AffinityTopologyVersion.NONE);
-    }
-
-    /**
      * Gets DHT affinity nodes.
      *
      * @param ctx Cache context.
-     * @param topOrder Maximum allowed node order.
-     * @return Affinity nodes.
+     * @param topVer Topology version.
+     * @return Cache affinity nodes for given topology version.
      */
-    public static Collection<ClusterNode> affinityNodes(GridCacheContext ctx, AffinityTopologyVersion topOrder) {
-        return ctx.discovery().cacheGroupAffinityNodes(ctx.groupId(), topOrder);
+    public static Collection<ClusterNode> affinityNodes(GridCacheContext ctx, AffinityTopologyVersion topVer) {
+        return ctx.discovery().cacheGroupAffinityNodes(ctx.groupId(), topVer);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 299394f..e994113 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
@@ -120,17 +120,20 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
 
     /**
      * @param cctx Context.
+     * @param discoCache Discovery data cache.
      * @param grpId Group ID.
      * @param parts Number of partitions in the group.
      * @param similarAffKey Key to find caches with similar affinity.
      */
     public GridClientPartitionTopology(
         GridCacheSharedContext<?, ?> cctx,
+        DiscoCache discoCache,
         int grpId,
         int parts,
         Object similarAffKey
     ) {
         this.cctx = cctx;
+        this.discoCache = discoCache;
         this.grpId = grpId;
         this.similarAffKey = similarAffKey;
         this.parts = parts;
@@ -338,7 +341,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
         }
 
         // In case if node joins, get topology at the time of joining node.
-        ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
+        ClusterNode oldest = discoCache.oldestAliveServerNode();
 
         assert oldest != null;
 
@@ -535,7 +538,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
      * @return List of nodes for the partition.
      */
     private List<ClusterNode> nodes(int p, AffinityTopologyVersion topVer, GridDhtPartitionState state, GridDhtPartitionState... states) {
-        Collection<UUID> allIds = topVer.topologyVersion() > 0 ? F.nodeIds(discoCache.allNodesWithCaches()) : null;
+        Collection<UUID> allIds = F.nodeIds(discoCache.cacheGroupAffinityNodes(grpId));
 
         lock.readLock().lock();
 
@@ -961,10 +964,10 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
         assert nodeId.equals(cctx.localNodeId());
 
         // In case if node joins, get topology at the time of joining node.
-        ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
+        ClusterNode oldest = discoCache.oldestAliveServerNode();
 
         // If this node became the oldest node.
-        if (oldest.id().equals(cctx.localNodeId())) {
+        if (cctx.localNode().equals(oldest)) {
             long seq = node2part.updateSequence();
 
             if (seq != updateSeq) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 f7f71a1..01d972d 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
@@ -326,7 +326,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
         if (grp.affinityNode()) {
             ClusterNode loc = ctx.localNode();
 
-            ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
+            ClusterNode oldest = discoCache.oldestAliveServerNode();
 
             GridDhtPartitionExchangeId exchId = exchFut.exchangeId();
 
@@ -466,7 +466,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
                         lastTopChangeVer = readyTopVer = evts.topologyVersion();
                     }
 
-                    ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
+                    ClusterNode oldest = discoCache.oldestAliveServerNode();
 
                     if (log.isDebugEnabled()) {
                         log.debug("Partition map beforeExchange [exchId=" + exchFut.exchangeId() +
@@ -2047,7 +2047,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
     private long updateLocal(int p, GridDhtPartitionState state, long updateSeq, AffinityTopologyVersion affVer) {
         assert lock.isWriteLockedByCurrentThread();
 
-        ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
+        ClusterNode oldest = discoCache.oldestAliveServerNode();
 
         assert oldest != null || ctx.kernalContext().clientNode();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index 5b8a7b5..ab5631e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -34,10 +34,10 @@ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.GridCacheMappedVersion;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse;
+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.transactions.IgniteInternalTx;
 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;
 import org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
@@ -313,24 +313,10 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
     /**
      * Prepares next batch of entries in dht transaction.
      *
-     * @param reads Read entries.
-     * @param writes Write entries.
-     * @param verMap Version map.
-     * @param msgId Message ID.
-     * @param nearMiniId Near mini future ID.
-     * @param txNodes Transaction nodes mapping.
-     * @param last {@code True} if this is last prepare request.
+     * @param req Prepare request.
      * @return Future that will be completed when locks are acquired.
      */
-    public final IgniteInternalFuture<GridNearTxPrepareResponse> prepareAsync(
-        @Nullable Collection<IgniteTxEntry> reads,
-        @Nullable Collection<IgniteTxEntry> writes,
-        Map<IgniteTxKey, GridCacheVersion> verMap,
-        long msgId,
-        int nearMiniId,
-        Map<UUID, Collection<UUID>> txNodes,
-        boolean last
-    ) {
+    public final IgniteInternalFuture<GridNearTxPrepareResponse> prepareAsync(GridNearTxPrepareRequest req) {
         // In optimistic mode prepare still can be called explicitly from salvageTx.
         GridDhtTxPrepareFuture fut = prepFut;
 
@@ -344,14 +330,14 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
                 cctx,
                 this,
                 timeout,
-                nearMiniId,
-                verMap,
-                last,
+                req.miniId(),
+                req.dhtVersions(),
+                req.last(),
                 needReturnValue()))) {
                 GridDhtTxPrepareFuture f = prepFut;
 
-                assert f.nearMiniId() == nearMiniId : "Wrong near mini id on existing future " +
-                    "[futMiniId=" + f.nearMiniId() + ", miniId=" + nearMiniId + ", fut=" + f + ']';
+                assert f.nearMiniId() == req.miniId() : "Wrong near mini id on existing future " +
+                    "[futMiniId=" + f.nearMiniId() + ", miniId=" + req.miniId() + ", fut=" + f + ']';
 
                 if (timeout == -1)
                     f.onError(timeoutException());
@@ -360,8 +346,8 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
             }
         }
         else {
-            assert fut.nearMiniId() == nearMiniId : "Wrong near mini id on existing future " +
-                "[futMiniId=" + fut.nearMiniId() + ", miniId=" + nearMiniId + ", fut=" + fut + ']';
+            assert fut.nearMiniId() == req.miniId() : "Wrong near mini id on existing future " +
+                "[futMiniId=" + fut.nearMiniId() + ", miniId=" + req.miniId() + ", fut=" + fut + ']';
 
             // Prepare was called explicitly.
             return chainOnePhasePrepare(fut);
@@ -389,14 +375,14 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
         }
 
         try {
-            if (reads != null) {
-                for (IgniteTxEntry e : reads)
-                    addEntry(msgId, e);
+            if (req.reads() != null) {
+                for (IgniteTxEntry e : req.reads())
+                    addEntry(req.messageId(), e);
             }
 
-            if (writes != null) {
-                for (IgniteTxEntry e : writes)
-                    addEntry(msgId, e);
+            if (req.writes() != null) {
+                for (IgniteTxEntry e : req.writes())
+                    addEntry(req.messageId(), e);
             }
 
             userPrepare(null);
@@ -407,7 +393,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
             if (isSystemInvalidate())
                 fut.complete();
             else
-                fut.prepare(reads, writes, txNodes);
+                fut.prepare(req);
         }
         catch (IgniteTxTimeoutCheckedException | IgniteTxOptimisticCheckedException e) {
             fut.onError(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 ce3c290..1c5e1a6 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
@@ -59,6 +59,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheEntry;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxMapping;
 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.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
@@ -168,14 +169,8 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
     @SuppressWarnings("UnusedDeclaration")
     private volatile int mapped;
 
-    /** Prepare reads. */
-    private Iterable<IgniteTxEntry> reads;
-
-    /** Prepare writes. */
-    private Iterable<IgniteTxEntry> writes;
-
-    /** Tx nodes. */
-    private Map<UUID, Collection<UUID>> txNodes;
+    /** Prepare request. */
+    private GridNearTxPrepareRequest req;
 
     /** Trackable flag. */
     private boolean trackable = true;
@@ -341,7 +336,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
     private void onEntriesLocked() {
         ret = new GridCacheReturn(null, tx.localResult(), true, null, true);
 
-        for (IgniteTxEntry writeEntry : writes) {
+        for (IgniteTxEntry writeEntry : req.writes()) {
             IgniteTxEntry txEntry = tx.entry(writeEntry.txKey());
 
             assert txEntry != null : writeEntry;
@@ -597,10 +592,10 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
         if (log.isDebugEnabled())
             log.debug("Marking all local candidates as ready: " + this);
 
-        readyLocks(writes);
+        readyLocks(req.writes());
 
         if (tx.serializable() && tx.optimistic())
-            readyLocks(reads);
+            readyLocks(req.reads());
 
         locksReady = true;
     }
@@ -896,8 +891,8 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
      */
     private void addDhtValues(GridNearTxPrepareResponse res) {
         // Interceptor on near node needs old values to execute callbacks.
-        if (!F.isEmpty(writes)) {
-            for (IgniteTxEntry e : writes) {
+        if (!F.isEmpty(req.writes())) {
+            for (IgniteTxEntry e : req.writes()) {
                 IgniteTxEntry txEntry = tx.entry(e.txKey());
 
                 assert txEntry != null : "Missing tx entry for key [tx=" + tx + ", key=" + e.txKey() + ']';
@@ -1002,33 +997,30 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
     /**
      * Initializes future.
      *
-     * @param reads Read entries.
-     * @param writes Write entries.
-     * @param txNodes Transaction nodes mapping.
+     * @param req Prepare request.
      */
     @SuppressWarnings("TypeMayBeWeakened")
-    public void prepare(Collection<IgniteTxEntry> reads, Collection<IgniteTxEntry> writes,
-        Map<UUID, Collection<UUID>> txNodes) {
+    public void prepare(GridNearTxPrepareRequest req) {
+        assert req != null;
+
         if (tx.empty()) {
             tx.setRollbackOnly();
 
             onDone((GridNearTxPrepareResponse)null);
         }
 
-        this.reads = reads;
-        this.writes = writes;
-        this.txNodes = txNodes;
+        this.req = req;
 
         boolean ser = tx.serializable() && tx.optimistic();
 
-        if (!F.isEmpty(writes) || (ser && !F.isEmpty(reads))) {
+        if (!F.isEmpty(req.writes()) || (ser && !F.isEmpty(req.reads()))) {
             Map<Integer, Collection<KeyCacheObject>> forceKeys = null;
 
-            for (IgniteTxEntry entry : writes)
+            for (IgniteTxEntry entry : req.writes())
                 forceKeys = checkNeedRebalanceKeys(entry, forceKeys);
 
             if (ser) {
-                for (IgniteTxEntry entry : reads)
+                for (IgniteTxEntry entry : req.reads())
                     forceKeys = checkNeedRebalanceKeys(entry, forceKeys);
             }
 
@@ -1196,10 +1188,10 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
                 IgniteCheckedException err0;
 
                 try {
-                    err0 = checkReadConflict(writes);
+                    err0 = checkReadConflict(req.writes());
 
                     if (err0 == null)
-                        err0 = checkReadConflict(reads);
+                        err0 = checkReadConflict(req.reads());
                 }
                 catch (IgniteCheckedException e) {
                     U.error(log, "Failed to check entry version: " + e, e);
@@ -1230,258 +1222,262 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             // We are holding transaction-level locks for entries here, so we can get next write version.
             tx.writeVersion(cctx.versions().next(tx.topologyVersion()));
 
-            {
-                // Assign keys to primary nodes.
-                if (!F.isEmpty(writes)) {
-                    for (IgniteTxEntry write : writes)
-                        map(tx.entry(write.txKey()));
-                }
+            // Assign keys to primary nodes.
+            if (!F.isEmpty(req.writes())) {
+                for (IgniteTxEntry write : req.writes())
+                    map(tx.entry(write.txKey()));
+            }
 
-                if (!F.isEmpty(reads)) {
-                    for (IgniteTxEntry read : reads)
-                        map(tx.entry(read.txKey()));
-                }
+            if (!F.isEmpty(req.reads())) {
+                for (IgniteTxEntry read : req.reads())
+                    map(tx.entry(read.txKey()));
             }
 
             if (isDone())
                 return;
 
-            if (last) {
-                if (tx.onePhaseCommit() && !tx.nearMap().isEmpty()) {
-                    for (GridDistributedTxMapping nearMapping : tx.nearMap().values()) {
-                        if (!tx.dhtMap().containsKey(nearMapping.primary().id())) {
-                            tx.onePhaseCommit(false);
+            if (last)
+                sendPrepareRequests();
+        }
+        finally {
+            markInitialized();
+        }
+    }
 
-                            break;
-                        }
-                    }
-                }
+    /**
+     *
+     */
+    private void sendPrepareRequests() {
+        if (tx.onePhaseCommit() && !tx.nearMap().isEmpty()) {
+            for (GridDistributedTxMapping nearMapping : tx.nearMap().values()) {
+                if (!tx.dhtMap().containsKey(nearMapping.primary().id())) {
+                    tx.onePhaseCommit(false);
 
-                int miniId = 0;
+                    break;
+                }
+            }
+        }
 
-                assert tx.transactionNodes() != null;
+        int miniId = 0;
 
-                final long timeout = timeoutObj != null ? timeoutObj.timeout : 0;
+        assert tx.transactionNodes() != null;
 
-                // Create mini futures.
-                for (GridDistributedTxMapping dhtMapping : tx.dhtMap().values()) {
-                    assert !dhtMapping.empty();
+        final long timeout = timeoutObj != null ? timeoutObj.timeout : 0;
 
-                    ClusterNode n = dhtMapping.primary();
+        // Create mini futures.
+        for (GridDistributedTxMapping dhtMapping : tx.dhtMap().values()) {
+            assert !dhtMapping.empty();
 
-                    assert !n.isLocal();
+            ClusterNode n = dhtMapping.primary();
 
-                    GridDistributedTxMapping nearMapping = tx.nearMap().get(n.id());
+            assert !n.isLocal();
 
-                    Collection<IgniteTxEntry> nearWrites = nearMapping == null ? null : nearMapping.writes();
+            GridDistributedTxMapping nearMapping = tx.nearMap().get(n.id());
 
-                    Collection<IgniteTxEntry> dhtWrites = dhtMapping.writes();
+            Collection<IgniteTxEntry> nearWrites = nearMapping == null ? null : nearMapping.writes();
 
-                    if (F.isEmpty(dhtWrites) && F.isEmpty(nearWrites))
-                        continue;
+            Collection<IgniteTxEntry> dhtWrites = dhtMapping.writes();
 
-                    if (tx.remainingTime() == -1)
-                        return;
+            if (F.isEmpty(dhtWrites) && F.isEmpty(nearWrites))
+                continue;
 
-                    MiniFuture fut = new MiniFuture(n.id(), ++miniId, dhtMapping, nearMapping);
+            if (tx.remainingTime() == -1)
+                return;
 
-                    add(fut); // Append new future.
+            MiniFuture fut = new MiniFuture(n.id(), ++miniId, dhtMapping, nearMapping);
+
+            add(fut); // Append new future.
+
+            assert req.transactionNodes() != null;
+
+            GridDhtTxPrepareRequest req = new GridDhtTxPrepareRequest(
+                futId,
+                fut.futureId(),
+                tx.topologyVersion(),
+                tx,
+                timeout,
+                dhtWrites,
+                nearWrites,
+                this.req.transactionNodes(),
+                tx.nearXidVersion(),
+                true,
+                tx.onePhaseCommit(),
+                tx.subjectId(),
+                tx.taskNameHash(),
+                tx.activeCachesDeploymentEnabled(),
+                tx.storeWriteThrough(),
+                retVal);
+
+            int idx = 0;
+
+            for (IgniteTxEntry entry : dhtWrites) {
+                try {
+                    GridDhtCacheEntry cached = (GridDhtCacheEntry)entry.cached();
 
-                    assert txNodes != null;
+                    GridCacheContext<?, ?> cacheCtx = cached.context();
 
-                    GridDhtTxPrepareRequest req = new GridDhtTxPrepareRequest(
-                        futId,
-                        fut.futureId(),
-                        tx.topologyVersion(),
-                        tx,
-                        timeout,
-                        dhtWrites,
-                        nearWrites,
-                        txNodes,
-                        tx.nearXidVersion(),
-                        true,
-                        tx.onePhaseCommit(),
-                        tx.subjectId(),
-                        tx.taskNameHash(),
-                        tx.activeCachesDeploymentEnabled(),
-                        tx.storeWriteThrough(),
-                        retVal);
+                    // Do not invalidate near entry on originating transaction node.
+                    req.invalidateNearEntry(idx, !tx.nearNodeId().equals(n.id()) &&
+                        cached.readerId(n.id()) != null);
 
-                    int idx = 0;
+                    if (cached.isNewLocked()) {
+                        List<ClusterNode> owners = cacheCtx.topology().owners(cached.partition(),
+                            tx != null ? tx.topologyVersion() : cacheCtx.affinity().affinityTopologyVersion());
 
-                    for (IgniteTxEntry entry : dhtWrites) {
-                        try {
-                            GridDhtCacheEntry cached = (GridDhtCacheEntry)entry.cached();
+                        // Do not preload if local node is a partition owner.
+                        if (!owners.contains(cctx.localNode()))
+                            req.markKeyForPreload(idx);
+                    }
 
-                            GridCacheContext<?, ?> cacheCtx = cached.context();
+                    break;
+                }
+                catch (GridCacheEntryRemovedException ignore) {
+                    assert false : "Got removed exception on entry with dht local candidate: " + entry;
+                }
 
-                            // Do not invalidate near entry on originating transaction node.
-                            req.invalidateNearEntry(idx, !tx.nearNodeId().equals(n.id()) &&
-                                cached.readerId(n.id()) != null);
+                idx++;
+            }
 
-                            if (cached.isNewLocked()) {
-                                List<ClusterNode> owners = cacheCtx.topology().owners(cached.partition(),
-                                    tx != null ? tx.topologyVersion() : cacheCtx.affinity().affinityTopologyVersion());
+            if (!F.isEmpty(nearWrites)) {
+                for (IgniteTxEntry entry : nearWrites) {
+                    try {
+                        if (entry.explicitVersion() == null) {
+                            GridCacheMvccCandidate added = entry.cached().candidate(version());
 
-                                // Do not preload if local node is a partition owner.
-                                if (!owners.contains(cctx.localNode()))
-                                    req.markKeyForPreload(idx);
-                            }
+                            assert added != null : "Missing candidate for cache entry:" + entry;
+                            assert added.dhtLocal();
 
-                            break;
-                        }
-                        catch (GridCacheEntryRemovedException ignore) {
-                            assert false : "Got removed exception on entry with dht local candidate: " + entry;
+                            if (added.ownerVersion() != null)
+                                req.owned(entry.txKey(), added.ownerVersion());
                         }
 
-                        idx++;
+                        break;
                     }
-
-                    if (!F.isEmpty(nearWrites)) {
-                        for (IgniteTxEntry entry : nearWrites) {
-                            try {
-                                if (entry.explicitVersion() == null) {
-                                    GridCacheMvccCandidate added = entry.cached().candidate(version());
-
-                                    assert added != null : "Missing candidate for cache entry:" + entry;
-                                    assert added.dhtLocal();
-
-                                    if (added.ownerVersion() != null)
-                                        req.owned(entry.txKey(), added.ownerVersion());
-                                }
-
-                                break;
-                            }
-                            catch (GridCacheEntryRemovedException ignore) {
-                                assert false : "Got removed exception on entry with dht local candidate: " + entry;
-                            }
-                        }
+                    catch (GridCacheEntryRemovedException ignore) {
+                        assert false : "Got removed exception on entry with dht local candidate: " + entry;
                     }
+                }
+            }
 
-                    assert req.transactionNodes() != null;
+            assert req.transactionNodes() != null;
 
-                    try {
-                        cctx.io().send(n, req, tx.ioPolicy());
+            try {
+                cctx.io().send(n, req, tx.ioPolicy());
 
-                        if (msgLog.isDebugEnabled()) {
-                            msgLog.debug("DHT prepare fut, sent request dht [txId=" + tx.nearXidVersion() +
-                                ", dhtTxId=" + tx.xidVersion() +
-                                ", node=" + n.id() + ']');
-                        }
-                    }
-                    catch (ClusterTopologyCheckedException ignored) {
-                        fut.onNodeLeft();
+                if (msgLog.isDebugEnabled()) {
+                    msgLog.debug("DHT prepare fut, sent request dht [txId=" + tx.nearXidVersion() +
+                        ", dhtTxId=" + tx.xidVersion() +
+                        ", node=" + n.id() + ']');
+                }
+            }
+            catch (ClusterTopologyCheckedException ignored) {
+                fut.onNodeLeft();
+            }
+            catch (IgniteCheckedException e) {
+                if (!cctx.kernalContext().isStopping()) {
+                    if (msgLog.isDebugEnabled()) {
+                        msgLog.debug("DHT prepare fut, failed to send request dht [txId=" + tx.nearXidVersion() +
+                            ", dhtTxId=" + tx.xidVersion() +
+                            ", node=" + n.id() + ']');
                     }
-                    catch (IgniteCheckedException e) {
-                        if (!cctx.kernalContext().isStopping()) {
-                            if (msgLog.isDebugEnabled()) {
-                                msgLog.debug("DHT prepare fut, failed to send request dht [txId=" + tx.nearXidVersion() +
-                                    ", dhtTxId=" + tx.xidVersion() +
-                                    ", node=" + n.id() + ']');
-                            }
 
-                            fut.onResult(e);
-                        }
-                        else {
-                            if (msgLog.isDebugEnabled()) {
-                                msgLog.debug("DHT prepare fut, failed to send request dht, ignore [txId=" + tx.nearXidVersion() +
-                                    ", dhtTxId=" + tx.xidVersion() +
-                                    ", node=" + n.id() +
-                                    ", err=" + e + ']');
-                            }
-                        }
+                    fut.onResult(e);
+                }
+                else {
+                    if (msgLog.isDebugEnabled()) {
+                        msgLog.debug("DHT prepare fut, failed to send request dht, ignore [txId=" + tx.nearXidVersion() +
+                            ", dhtTxId=" + tx.xidVersion() +
+                            ", node=" + n.id() +
+                            ", err=" + e + ']');
                     }
                 }
+            }
+        }
 
-                for (GridDistributedTxMapping nearMapping : tx.nearMap().values()) {
-                    if (!tx.dhtMap().containsKey(nearMapping.primary().id())) {
-                        if (tx.remainingTime() == -1)
-                            return;
-
-                        MiniFuture fut = new MiniFuture(nearMapping.primary().id(), ++miniId, null, nearMapping);
-
-                        add(fut); // Append new future.
-
-                        GridDhtTxPrepareRequest req = new GridDhtTxPrepareRequest(
-                            futId,
-                            fut.futureId(),
-                            tx.topologyVersion(),
-                            tx,
-                            timeout,
-                            null,
-                            nearMapping.writes(),
-                            tx.transactionNodes(),
-                            tx.nearXidVersion(),
-                            true,
-                            tx.onePhaseCommit(),
-                            tx.subjectId(),
-                            tx.taskNameHash(),
-                            tx.activeCachesDeploymentEnabled(),
-                            tx.storeWriteThrough(),
-                            retVal);
-
-                        for (IgniteTxEntry entry : nearMapping.entries()) {
-                            if (CU.writes().apply(entry)) {
-                                try {
-                                    if (entry.explicitVersion() == null) {
-                                        GridCacheMvccCandidate added = entry.cached().candidate(version());
+        for (GridDistributedTxMapping nearMapping : tx.nearMap().values()) {
+            if (!tx.dhtMap().containsKey(nearMapping.primary().id())) {
+                if (tx.remainingTime() == -1)
+                    return;
 
-                                        assert added != null : "Null candidate for non-group-lock entry " +
-                                            "[added=" + added + ", entry=" + entry + ']';
-                                        assert added.dhtLocal() : "Got non-dht-local candidate for prepare future" +
-                                            "[added=" + added + ", entry=" + entry + ']';
+                MiniFuture fut = new MiniFuture(nearMapping.primary().id(), ++miniId, null, nearMapping);
+
+                add(fut); // Append new future.
+
+                GridDhtTxPrepareRequest req = new GridDhtTxPrepareRequest(
+                    futId,
+                    fut.futureId(),
+                    tx.topologyVersion(),
+                    tx,
+                    timeout,
+                    null,
+                    nearMapping.writes(),
+                    tx.transactionNodes(),
+                    tx.nearXidVersion(),
+                    true,
+                    tx.onePhaseCommit(),
+                    tx.subjectId(),
+                    tx.taskNameHash(),
+                    tx.activeCachesDeploymentEnabled(),
+                    tx.storeWriteThrough(),
+                    retVal);
+
+                for (IgniteTxEntry entry : nearMapping.entries()) {
+                    if (CU.writes().apply(entry)) {
+                        try {
+                            if (entry.explicitVersion() == null) {
+                                GridCacheMvccCandidate added = entry.cached().candidate(version());
 
-                                        if (added != null && added.ownerVersion() != null)
-                                            req.owned(entry.txKey(), added.ownerVersion());
-                                    }
+                                assert added != null : "Null candidate for non-group-lock entry " +
+                                    "[added=" + added + ", entry=" + entry + ']';
+                                assert added.dhtLocal() : "Got non-dht-local candidate for prepare future" +
+                                    "[added=" + added + ", entry=" + entry + ']';
 
-                                    break;
-                                } catch (GridCacheEntryRemovedException ignore) {
-                                    assert false : "Got removed exception on entry with dht local candidate: " + entry;
-                                }
+                                if (added != null && added.ownerVersion() != null)
+                                    req.owned(entry.txKey(), added.ownerVersion());
                             }
+
+                            break;
+                        } catch (GridCacheEntryRemovedException ignore) {
+                            assert false : "Got removed exception on entry with dht local candidate: " + entry;
                         }
+                    }
+                }
 
-                        assert req.transactionNodes() != null;
+                assert req.transactionNodes() != null;
 
-                        try {
-                            cctx.io().send(nearMapping.primary(), req, tx.ioPolicy());
+                try {
+                    cctx.io().send(nearMapping.primary(), req, tx.ioPolicy());
 
-                            if (msgLog.isDebugEnabled()) {
-                                msgLog.debug("DHT prepare fut, sent request near [txId=" + tx.nearXidVersion() +
-                                    ", dhtTxId=" + tx.xidVersion() +
-                                    ", node=" + nearMapping.primary().id() + ']');
-                            }
-                        }
-                        catch (ClusterTopologyCheckedException ignored) {
-                            fut.onNodeLeft();
+                    if (msgLog.isDebugEnabled()) {
+                        msgLog.debug("DHT prepare fut, sent request near [txId=" + tx.nearXidVersion() +
+                            ", dhtTxId=" + tx.xidVersion() +
+                            ", node=" + nearMapping.primary().id() + ']');
+                    }
+                }
+                catch (ClusterTopologyCheckedException ignored) {
+                    fut.onNodeLeft();
+                }
+                catch (IgniteCheckedException e) {
+                    if (!cctx.kernalContext().isStopping()) {
+                        if (msgLog.isDebugEnabled()) {
+                            msgLog.debug("DHT prepare fut, failed to send request near [txId=" + tx.nearXidVersion() +
+                                ", dhtTxId=" + tx.xidVersion() +
+                                ", node=" + nearMapping.primary().id() + ']');
                         }
-                        catch (IgniteCheckedException e) {
-                            if (!cctx.kernalContext().isStopping()) {
-                                if (msgLog.isDebugEnabled()) {
-                                    msgLog.debug("DHT prepare fut, failed to send request near [txId=" + tx.nearXidVersion() +
-                                        ", dhtTxId=" + tx.xidVersion() +
-                                        ", node=" + nearMapping.primary().id() + ']');
-                                }
 
-                                fut.onResult(e);
-                            }
-                            else {
-                                if (msgLog.isDebugEnabled()) {
-                                    msgLog.debug("DHT prepare fut, failed to send request near, ignore [txId=" + tx.nearXidVersion() +
-                                        ", dhtTxId=" + tx.xidVersion() +
-                                        ", node=" + nearMapping.primary().id() +
-                                        ", err=" + e + ']');
-                                }
-                            }
+                        fut.onResult(e);
+                    }
+                    else {
+                        if (msgLog.isDebugEnabled()) {
+                            msgLog.debug("DHT prepare fut, failed to send request near, ignore [txId=" + tx.nearXidVersion() +
+                                ", dhtTxId=" + tx.xidVersion() +
+                                ", node=" + nearMapping.primary().id() +
+                                ", err=" + e + ']');
                         }
                     }
                 }
             }
         }
-        finally {
-            markInitialized();
-        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 1467bfa..7d0f747 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
@@ -1965,7 +1965,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         if (dhtFut != null) {
             if (req.writeSynchronizationMode() == PRIMARY_SYNC
                 // To avoid deadlock disable back-pressure for sender data node.
-                && !ctx.discovery().cacheAffinityNode(node, ctx.name())
+                && !ctx.discovery().cacheGroupAffinityNode(node, ctx.groupId())
                 && !dhtFut.isDone()) {
                 final IgniteRunnable tracker = GridNioBackPressureControl.threadTracker();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 c72f53e..053bbe5 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
@@ -712,7 +712,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
                     }
 
                     if (map == null) {
-                        Collection<ClusterNode> affNodes = CU.allNodes(ctx, topVer);
+                        Collection<ClusterNode> affNodes = CU.affinityNodes(ctx, topVer);
 
                         keyCnt = (int)Math.ceil((double)keys.size() / affNodes.size());
 
@@ -815,7 +815,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
                     AffinityTopologyVersion topVer = lock.topologyVersion();
 
                     if (map == null) {
-                        Collection<ClusterNode> affNodes = CU.allNodes(ctx, topVer);
+                        Collection<ClusterNode> affNodes = CU.affinityNodes(ctx, topVer);
 
                         keyCnt = (int)Math.ceil((double)keys.size() / affNodes.size());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 240b5f0..9589f09 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
@@ -2247,7 +2247,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                     CacheGroupContext grp = cctx.cache().cacheGroup(desc.groupId());
 
                     GridDhtPartitionTopology top = grp != null ? grp.topology() :
-                        cctx.exchange().clientTopology(desc.groupId());
+                        cctx.exchange().clientTopology(desc.groupId(), events().discoveryCache());
 
                     top.beforeExchange(this, true, true);
                 }
@@ -2265,7 +2265,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                     CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
 
                     GridDhtPartitionTopology top = grp != null ? grp.topology() :
-                        cctx.exchange().clientTopology(grpId);
+                        cctx.exchange().clientTopology(grpId, events().discoveryCache());
 
                     CachePartitionPartialCountersMap cntrs = msg.partitionUpdateCounters(grpId,
                         top.partitions());
@@ -2448,7 +2448,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                 if (grpCtx != null)
                     top = grpCtx.topology();
                 else
-                    top = cctx.exchange().clientTopology(e.getKey());
+                    top = cctx.exchange().clientTopology(e.getKey(), events().discoveryCache());
 
                 assignPartitionStates(top);
             }
@@ -2826,10 +2826,10 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                     null);
             }
             else {
-                ClusterNode oldest = cctx.discovery().oldestAliveCacheServerNode(AffinityTopologyVersion.NONE);
+                ClusterNode oldest = cctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE);
 
                 if (oldest != null && oldest.isLocal()) {
-                    GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId);
+                    GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId, events().discoveryCache());
 
                     CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId,
                         top.partitions());
@@ -2858,7 +2858,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
 
             GridDhtPartitionTopology top = grp != null ? grp.topology() :
-                cctx.exchange().clientTopology(grpId);
+                cctx.exchange().clientTopology(grpId, events().discoveryCache());
 
             top.update(exchId, entry.getValue(), false);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 a691cbc..973a199 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
@@ -540,7 +540,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
                             ver = cand.version();
 
                             if (map == null) {
-                                Collection<ClusterNode> affNodes = CU.allNodes(ctx, cand.topologyVersion());
+                                Collection<ClusterNode> affNodes = CU.affinityNodes(ctx, cand.topologyVersion());
 
                                 if (F.isEmpty(affNodes))
                                     return;
@@ -663,7 +663,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
 
                             if (cand != null) {
                                 if (map == null) {
-                                    Collection<ClusterNode> affNodes = CU.allNodes(ctx, cand.topologyVersion());
+                                    Collection<ClusterNode> affNodes = CU.affinityNodes(ctx, cand.topologyVersion());
 
                                     if (F.isEmpty(affNodes))
                                         return;

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 55d6bdd..8ecf21f 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
@@ -105,14 +105,12 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
 import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
 import static org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry.SER_READ_EMPTY_ENTRY_VER;
 import static org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry.SER_READ_NOT_EMPTY_VER;
-import static org.apache.ignite.transactions.TransactionState.ACTIVE;
 import static org.apache.ignite.transactions.TransactionState.COMMITTED;
 import static org.apache.ignite.transactions.TransactionState.COMMITTING;
 import static org.apache.ignite.transactions.TransactionState.PREPARED;
 import static org.apache.ignite.transactions.TransactionState.PREPARING;
 import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK;
 import static org.apache.ignite.transactions.TransactionState.ROLLING_BACK;
-import static org.apache.ignite.transactions.TransactionState.SUSPENDED;
 import static org.apache.ignite.transactions.TransactionState.UNKNOWN;
 
 /**
@@ -3338,19 +3336,11 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
     /**
      * Prepares next batch of entries in dht transaction.
      *
-     * @param reads Read entries.
-     * @param writes Write entries.
-     * @param txNodes Transaction nodes mapping.
-     * @param last {@code True} if this is last prepare request.
+     * @param req Prepare request.
      * @return Future that will be completed when locks are acquired.
      */
     @SuppressWarnings("TypeMayBeWeakened")
-    public IgniteInternalFuture<GridNearTxPrepareResponse> prepareAsyncLocal(
-        @Nullable Collection<IgniteTxEntry> reads,
-        @Nullable Collection<IgniteTxEntry> writes,
-        Map<UUID, Collection<UUID>> txNodes,
-        boolean last
-    ) {
+    public IgniteInternalFuture<GridNearTxPrepareResponse> prepareAsyncLocal(GridNearTxPrepareRequest req) {
         long timeout = remainingTime();
 
         if (state() != PREPARING) {
@@ -3375,11 +3365,11 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
             timeout,
             0,
             Collections.<IgniteTxKey, GridCacheVersion>emptyMap(),
-            last,
+            req.last(),
             needReturnValue() && implicit());
 
         try {
-            userPrepare((serializable() && optimistic()) ? F.concat(false, writes, reads) : writes);
+            userPrepare((serializable() && optimistic()) ? F.concat(false, req.writes(), req.reads()) : req.writes());
 
             // Make sure to add future before calling prepare on it.
             cctx.mvcc().addFuture(fut);
@@ -3387,7 +3377,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
             if (isSystemInvalidate())
                 fut.complete();
             else
-                fut.prepare(reads, writes, txNodes);
+                fut.prepare(req);
         }
         catch (IgniteTxTimeoutCheckedException | IgniteTxOptimisticCheckedException e) {
             fut.onError(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index c4eae8c..b5fdd23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -600,7 +600,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
 
         final AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();
 
-        Collection<ClusterNode> affNodes = CU.affinityNodes(cctx);
+        Collection<ClusterNode> affNodes = CU.affinityNodes(cctx, topVer);
 
         if (prj == null && part == null)
             return affNodes;

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 3e27720..f873461 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
@@ -1859,11 +1859,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
             Callable<Collection<CacheSqlMetadata>> job = new MetadataJob();
 
             // Remote nodes that have current cache.
-            Collection<ClusterNode> nodes = F.view(cctx.discovery().remoteNodes(), new P1<ClusterNode>() {
-                @Override public boolean apply(ClusterNode n) {
-                    return cctx.kernalContext().discovery().cacheAffinityNode(n, cacheName);
-                }
-            });
+            Collection<ClusterNode> nodes = CU.affinityNodes(cctx, AffinityTopologyVersion.NONE);
 
             Collection<Collection<CacheSqlMetadata>> res = new ArrayList<>(nodes.size() + 1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/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 beeb184..362eaac 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
@@ -254,11 +254,7 @@ public class IgniteTxHandler {
     ) {
         req.txState(locTx.txState());
 
-        IgniteInternalFuture<GridNearTxPrepareResponse> fut = locTx.prepareAsyncLocal(
-            req.reads(),
-            req.writes(),
-            req.transactionNodes(),
-            req.last());
+        IgniteInternalFuture<GridNearTxPrepareResponse> fut = locTx.prepareAsyncLocal(req);
 
         if (locTx.isRollbackOnly())
             locTx.rollbackNearTxLocalAsync();
@@ -520,14 +516,7 @@ public class IgniteTxHandler {
             if (req.needReturnValue())
                 tx.needReturnValue(true);
 
-            IgniteInternalFuture<GridNearTxPrepareResponse> fut = tx.prepareAsync(
-                req.reads(),
-                req.writes(),
-                req.dhtVersions(),
-                req.messageId(),
-                req.miniId(),
-                req.transactionNodes(),
-                req.last());
+            IgniteInternalFuture<GridNearTxPrepareResponse> fut = tx.prepareAsync(req);
 
             if (tx.isRollbackOnly() && !tx.commitOnPrepare()) {
                 if (tx.state() != TransactionState.ROLLED_BACK && tx.state() != TransactionState.ROLLING_BACK)

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 2b3a882..f750053 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -1489,7 +1489,7 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
 
             if (!cache.context().affinityNode()) {
                 ClusterNode oldestSrvNode =
-                    ctx.discovery().oldestAliveCacheServerNode(AffinityTopologyVersion.NONE);
+                    ctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE);
 
                 if (oldestSrvNode == null)
                     return new GridEmptyIterator<>();
@@ -1730,7 +1730,7 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
                         // In case the cache instance isn't tracked by DiscoveryManager anymore.
                         discoCache.updateAlives(ctx.discovery());
 
-                        ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
+                        ClusterNode oldest = discoCache.oldestAliveServerNode();
 
                         if (oldest != null && oldest.isLocal()) {
                             final Collection<GridServiceDeployment> retries = new ConcurrentLinkedQueue<>();

http://git-wip-us.apache.org/repos/asf/ignite/blob/788adc0d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
index 695d8a6..95e9479 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
@@ -2826,7 +2826,7 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
 
         assertNotNull("Failed to find exchange future:", evt);
 
-        Collection<ClusterNode> allNodes = ctx.discovery().cacheNodes(topVer0);
+        Collection<ClusterNode> allNodes = ctx.discovery().serverNodes(topVer0);
 
         for (DynamicCacheDescriptor cacheDesc : ctx.cache().cacheDescriptors().values()) {
             if (assignments.get(cacheDesc.cacheId()) != null)


[14/14] ignite git commit: ignite-3484

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


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

Branch: refs/heads/ignite-3484
Commit: 91b9911731a387a3199ddbbc22704bc14af09995
Parents: c966451
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 6 12:22:22 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 6 17:34:10 2017 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheOffheapManagerImpl.java    |  10 +-
 .../mvcc/CacheCoordinatorsSharedManager.java    | 113 +++--
 .../processors/cache/tree/CacheDataTree.java    |   2 +-
 .../cache/mvcc/CacheMvccTransactionsTest.java   | 424 ++++++++++++++++++-
 4 files changed, 515 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/91b99117/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index ed52b85..9a4b17b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -1552,18 +1552,20 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
 
             int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID;
 
-            // TODO IGNITE-3484: need special findCeiling method.
+            // TODO IGNITE-3484: need special method.
 
             GridCursor<CacheDataRow> cur = dataTree.find(new MvccSearchRow(cacheId, key, topVer, mvccCntr),
-                null,
-                CacheDataRowAdapter.RowData.NO_KEY);
+                new MvccSearchRow(cacheId, key, topVer + 1, mvccCntr)/*,
+                CacheDataRowAdapter.RowData.NO_KEY*/);
 
             CacheDataRow row = null;
 
             if (cur.next())
                 row = cur.get();
 
-            afterRowFound(row, key);
+            assert row == null || key.equals(row.key());
+
+            //afterRowFound(row, key);
 
             return row;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/91b99117/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 807d18a..f780922 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,8 @@
 
 package org.apache.ignite.internal.processors.cache.mvcc;
 
+import java.util.HashMap;
+import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -34,6 +36,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridAtomicLong;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -52,15 +55,18 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
     private final CoordinatorAssignmentHistory assignHist = new CoordinatorAssignmentHistory();
 
     /** */
-    private final AtomicLong mvccCntr = new AtomicLong(0L);
+    private final AtomicLong mvccCntr = new AtomicLong(1L);
 
     /** */
-    private final AtomicLong committedCntr = new AtomicLong(0L);
+    private final GridAtomicLong committedCntr = new GridAtomicLong(1L);
 
     /** */
     private final ConcurrentHashMap<GridCacheVersion, Long> activeTxs = new ConcurrentHashMap<>();
 
     /** */
+    private final Map<Long, Integer> activeQueries = new HashMap<>();
+
+    /** */
     private final ConcurrentMap<Long, MvccCounterFuture> cntrFuts = new ConcurrentHashMap<>();
 
     /** */
@@ -210,21 +216,6 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
         }
     }
 
-
-    /**
-     * @param txId Transaction ID.
-     * @return Counter.
-     */
-    private long assignTxCounter(GridCacheVersion txId) {
-        long nextCtr = mvccCntr.incrementAndGet();
-
-        Object old = activeTxs.put(txId, nextCtr);
-
-        assert old == null : txId;
-
-        return nextCtr;
-    }
-
     /**
      * @param nodeId Sender node ID.
      * @param msg Message.
@@ -322,7 +313,7 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
      * @param msg Message.
      */
     private void processCoordinatorTxAckRequest(UUID nodeId, CoordinatorTxAckRequest msg) {
-        activeTxs.remove(msg.txId());
+        onTxDone(msg.txId());
 
         if (!msg.skipResponse()) {
             try {
@@ -359,19 +350,93 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
     }
 
     /**
+     * @param txId Transaction ID.
+     * @return Counter.
+     */
+    private synchronized long assignTxCounter(GridCacheVersion txId) {
+        long nextCtr = mvccCntr.getAndIncrement();
+
+        Object old = activeTxs.put(txId, nextCtr);
+
+        assert old == null : txId;
+
+        return nextCtr;
+    }
+
+    /**
+     * @param txId Transaction ID.
+     */
+    private synchronized void onTxDone(GridCacheVersion txId) {
+        Long cntr = activeTxs.remove(txId);
+
+        assert cntr != null;
+
+        committedCntr.setIfGreater(cntr);
+    }
+
+    /**
      * @param qryNodeId Node initiated query.
      * @return Counter for query.
      */
-    private long assignQueryCounter(UUID qryNodeId) {
-        // TODO IGNITE-3478
-        return 3;
+    private synchronized long assignQueryCounter(UUID qryNodeId) {
+        Long mvccCntr = committedCntr.get();
+
+        Long minActive = minActiveTx();
+
+        if (minActive != null && minActive < mvccCntr)
+            mvccCntr = minActive - 1;
+
+        Integer queries = activeQueries.get(mvccCntr);
+
+        if (queries != null)
+            activeQueries.put(mvccCntr, queries + 1);
+        else
+            activeQueries.put(mvccCntr, 1);
+
+        return mvccCntr;
     }
 
     /**
-     * @param cntr Query counter.
+     * @param mvccCntr Query counter.
      */
-    private void onQueryDone(long cntr) {
-        // TODO IGNITE-3478
+    private synchronized void onQueryDone(long mvccCntr) {
+        Integer queries = activeQueries.get(mvccCntr);
+
+        assert queries != null : mvccCntr;
+
+        int left = queries - 1;
+
+        assert left >= 0 : left;
+
+        if (left == 0)
+            activeQueries.remove(mvccCntr);
+    }
+
+    private synchronized long cleanupVersion() {
+        long cntr = committedCntr.get();
+
+        Long minActive = minActiveTx();
+
+        if (minActive != null && minActive < cntr)
+            cntr = minActive - 1;
+
+        for (Long qryCntr : activeQueries.keySet()) {
+            if (qryCntr <= cntr)
+                cntr = qryCntr - 1;
+        }
+
+        return cntr;
+    }
+
+    @Nullable private Long minActiveTx() {
+        Long min = null;
+
+        for (Map.Entry<GridCacheVersion, Long> e : activeTxs.entrySet()) {
+            if (min == null || e.getValue() < min)
+                min = e.getValue();
+        }
+
+        return min;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/91b99117/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
index e846768..4b4860b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
@@ -163,7 +163,7 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow> {
         cmp = Long.compare(row.mvccUpdateTopologyVersion(), mvccTopVer);
 
         if (cmp != 0)
-            return 0;
+            return cmp;
 
         long mvccCntr = io.getMvccUpdateCounter(pageAddr, idx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/91b99117/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 19f1dc7..4c6b206 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
@@ -18,21 +18,34 @@
 package org.apache.ignite.internal.processors.cache.mvcc;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteTransactions;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.util.lang.GridInClosure3;
 import org.apache.ignite.internal.util.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -158,7 +171,7 @@ public class CacheMvccTransactionsTest extends GridCommonAbstractTest {
         startGridsMultiThreaded(SRVS);
 
         try {
-            for (CacheConfiguration<Integer, Integer> ccfg : cacheConfigurations()) {
+            for (CacheConfiguration<Object, Object> ccfg : cacheConfigurations()) {
                 logCacheInfo(ccfg);
 
                 ignite(0).createCache(ccfg);
@@ -211,10 +224,383 @@ public class CacheMvccTransactionsTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testSimplePutGetAll() throws Exception {
+        Ignite node = startGrid(0);
+
+        IgniteTransactions txs = node.transactions();
+
+        final IgniteCache<Object, Object> cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0));
+
+        final int KEYS = 10_000;
+
+        Set<Integer> keys = new HashSet<>();
+
+        for (int k = 0; k < KEYS; k++)
+            keys.add(k);
+
+        Map<Object, Object> map = cache.getAll(keys);
+
+        assertTrue(map.isEmpty());
+
+        for (int v = 0; v < 3; v++) {
+            try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                for (int k = 0; k < KEYS; k++) {
+                    if (k % 2 == 0)
+                        cache.put(k, v);
+                }
+
+                tx.commit();
+            }
+
+            map = cache.getAll(keys);
+
+            for (int k = 0; k < KEYS; k++) {
+                if (k % 2 == 0)
+                    assertEquals(v, map.get(k));
+                else
+                    assertNull(map.get(k));
+            }
+
+            assertEquals(KEYS / 2, map.size());
+
+            try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                map = cache.getAll(keys);
+
+                for (int k = 0; k < KEYS; k++) {
+                    if (k % 2 == 0)
+                        assertEquals(v, map.get(k));
+                    else
+                        assertNull(map.get(k));
+                }
+
+                assertEquals(KEYS / 2, map.size());
+
+                tx.commit();
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutAllGetAll() throws Exception {
+        final int RANGE = 20;
+
+        final long time = 10_000;
+
+        final int writers = 4;
+
+        final int readers = 4;
+
+        GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean> writer =
+            new GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean>() {
+            @Override public void apply(Integer idx, IgniteCache<Object, Object> cache, AtomicBoolean stop) {
+                final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions();
+
+                ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+                int min = idx * RANGE;
+                int max = min + RANGE;
+
+                info("Thread range [min=" + min + ", max=" + max + ']');
+
+                Map<Integer, Integer> map = new HashMap<>();
+
+                int v = idx * 1_000_000;
+
+                while (!stop.get()) {
+                    while (map.size() < RANGE)
+                        map.put(rnd.nextInt(min, max), v);
+
+                    try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                        cache.putAll(map);
+
+                        tx.commit();
+                    }
+
+                    map.clear();
+
+                    v++;
+                }
+
+                info("Writer done, updates: " + v);
+            }
+        };
+
+        GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean> reader =
+            new GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean>() {
+                @Override public void apply(Integer idx, IgniteCache<Object, Object> cache, AtomicBoolean stop) {
+                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+                    Set<Integer> keys = new LinkedHashSet<>();
+
+                    Map<Integer, Set<Integer>> uniqueReads = new HashMap<>();
+
+                    for (int i = 0; i < writers; i++)
+                        uniqueReads.put(i, new HashSet<Integer>());
+
+                    while (!stop.get()) {
+                        int range = rnd.nextInt(0, writers);
+
+                        int min = range * RANGE;
+                        int max = min + RANGE;
+
+                        while (keys.size() < RANGE)
+                            keys.add(rnd.nextInt(min, max));
+
+                        Map<Object, Object> map = cache.getAll(keys);
+
+                        assertTrue("Invalid map size: " + map.size(),
+                            map.isEmpty() || map.size() == RANGE);
+
+                        Integer val0 = null;
+
+                        for (Map.Entry<Object, Object> e: map.entrySet()) {
+                            Object val = e.getValue();
+
+                            assertNotNull(val);
+
+                            if (val0 == null) {
+                                uniqueReads.get(range).add((Integer)val);
+
+                                val0 = (Integer)val;
+                            }
+                            else {
+                                if (!F.eq(val0, val)) {
+                                    assertEquals("Unexpected value [range=" + range + ", key=" + e.getKey() + ']',
+                                        val0,
+                                        val);
+                                }
+                            }
+                        }
+
+                        keys.clear();
+                    }
+
+                    info("Reader done, unique reads: ");
+
+                    for (Map.Entry<Integer, Set<Integer>> e : uniqueReads.entrySet())
+                        info("Range [idx=" + e.getKey() + ", uniqueReads=" + e.getValue().size() + ']');
+                }
+            };
+
+        readWriteTest(time, writers, readers, null, writer, reader);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAccountsSumGetAll() throws Exception {
+        final int ACCOUNTS = 20;
+
+        final int ACCOUNT_START_VAL = 1000;
+
+        final long time = 10_000;
+
+        final int writers = 1;
+
+        final int readers = 1;
+
+        final IgniteInClosure<IgniteCache<Object, Object>> init = new IgniteInClosure<IgniteCache<Object, Object>>() {
+            @Override public void apply(IgniteCache<Object, Object> cache) {
+                final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions();
+
+                Map<Integer, Account> accounts = new HashMap<>();
+
+                for (int i = 0; i < ACCOUNTS; i++)
+                    accounts.put(i, new Account(ACCOUNT_START_VAL));
+
+                try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                    cache.putAll(accounts);
+
+                    tx.commit();
+                }
+            }
+        };
+
+        GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean> writer =
+            new GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean>() {
+                @Override public void apply(Integer idx, IgniteCache<Object, Object> cache, AtomicBoolean stop) {
+                    final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions();
+
+                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+                    int cnt = 0;
+
+                    while (!stop.get()) {
+                        cnt++;
+
+                        try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                            Integer id1 = rnd.nextInt(ACCOUNTS);
+                            Integer id2 = rnd.nextInt(ACCOUNTS);
+
+                            if (id1.equals(id2))
+                                continue;
+
+                            Account a1;
+                            Account a2;
+
+                            TreeSet<Integer> keys = new TreeSet<>();
+
+                            keys.add(id1);
+                            keys.add(id2);
+
+                            Map<Object, Object> accounts = cache.getAll(keys);
+
+                            a1 = (Account)accounts.get(id1);
+                            a2 = (Account)accounts.get(id1);
+
+                            assertNotNull(a1);
+                            assertNotNull(a2);
+
+                            cache.put(id1, new Account(a1.val + 1));
+                            cache.put(id2, new Account(a2.val - 1));
+
+                            tx.commit();
+                        }
+                    }
+
+                    info("Writer finished, updates: " + cnt);
+                }
+            };
+
+        GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean> reader =
+            new GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean>() {
+                @Override public void apply(Integer idx, IgniteCache<Object, Object> cache, AtomicBoolean stop) {
+                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+                    Set<Integer> keys = new LinkedHashSet<>();
+
+                    while (!stop.get()) {
+                        while (keys.size() < ACCOUNTS)
+                            keys.add(rnd.nextInt(ACCOUNTS));
+
+                        Map<Object, Object> accounts = cache.getAll(keys);
+
+                        assertEquals(ACCOUNTS, accounts.size());
+
+                        int sum = 0;
+
+                        for (int i = 0; i < ACCOUNTS; i++) {
+                            Account account = (Account)accounts.get(i);
+
+                            assertNotNull(account);
+
+                            sum += account.val;
+                        }
+
+                        assertEquals(ACCOUNTS * ACCOUNT_START_VAL, sum);
+                    }
+
+                    if (idx == 0) {
+                        Map<Object, Object> accounts = cache.getAll(keys);
+
+                        int sum = 0;
+
+                        for (int i = 0; i < ACCOUNTS; i++) {
+                            Account account = (Account)accounts.get(i);
+
+                            info("Account [id=" + i + ", val=" + account.val + ']');
+
+                            sum += account.val;
+                        }
+
+                        info("Sum: " + sum);
+                    }
+                }
+            };
+
+        readWriteTest(time, writers, readers, init, writer, reader);
+    }
+
+    /**
+     * @param time Test time.
+     * @param writers Number of writers.
+     * @param readers Number of readers.
+     * @param writer Writers threads closure.
+     * @param reader Readers threads closure.
+     * @throws Exception If failed.
+     */
+    private void readWriteTest(final long time,
+        final int writers,
+        final int readers,
+        IgniteInClosure<IgniteCache<Object, Object>> init,
+        final GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean> writer,
+        final GridInClosure3<Integer, IgniteCache<Object, Object>, AtomicBoolean> reader) throws Exception {
+        final Ignite ignite = startGrid(0);
+
+        final IgniteCache<Object, Object> cache = ignite.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0));
+
+        if (init != null)
+            init.apply(cache);
+
+        final long stopTime = U.currentTimeMillis() + time;
+
+        final AtomicBoolean stop = new AtomicBoolean();
+
+        try {
+            final AtomicInteger writerIdx = new AtomicInteger();
+
+            IgniteInternalFuture<?> writeFut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+                @Override public Void call() throws Exception {
+                    try {
+                        int idx = writerIdx.getAndIncrement();
+
+                        writer.apply(idx, cache, stop);
+                    }
+                    catch (Throwable e) {
+                        error("Unexpected error: " + e, e);
+
+                        stop.set(true);
+
+                        fail("Unexpected error: " + e);
+                    }
+
+                    return null;
+                }
+            }, writers, "writer");
+
+            final AtomicInteger readerIdx = new AtomicInteger();
+
+            IgniteInternalFuture<?> readFut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+                @Override public Void call() throws Exception {
+                    try {
+                        int idx = readerIdx.getAndIncrement();
+
+                        reader.apply(idx, cache, stop);
+                    }
+                    catch (Throwable e) {
+                        error("Unexpected error: " + e, e);
+
+                        stop.set(true);
+
+                        fail("Unexpected error: " + e);
+                    }
+
+                    return null;
+                }
+            }, readers, "reader");
+
+            while (System.currentTimeMillis() < stopTime && !stop.get())
+                Thread.sleep(1000);
+
+            stop.set(true);
+
+            writeFut.get();
+            readFut.get();
+        }
+        finally {
+            stop.set(true);
+        }
+    }
+
+    /**
      * @return Cache configurations.
      */
-    private List<CacheConfiguration<Integer, Integer>> cacheConfigurations() {
-        List<CacheConfiguration<Integer, Integer>> ccfgs = new ArrayList<>();
+    private List<CacheConfiguration<Object, Object>> cacheConfigurations() {
+        List<CacheConfiguration<Object, Object>> ccfgs = new ArrayList<>();
 
         ccfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 0));
         ccfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 1));
@@ -262,16 +648,17 @@ public class CacheMvccTransactionsTest extends GridCommonAbstractTest {
      * @param backups Number of backups.
      * @return Cache configuration.
      */
-    private CacheConfiguration<Integer, Integer> cacheConfiguration(
+    private CacheConfiguration<Object, Object> cacheConfiguration(
         CacheMode cacheMode,
         CacheWriteSynchronizationMode syncMode,
         int backups) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setWriteSynchronizationMode(syncMode);
         ccfg.setMvccEnabled(true);
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, 1));
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);
@@ -299,4 +686,31 @@ public class CacheMvccTransactionsTest extends GridCommonAbstractTest {
             assertTrue(ackFuts.isEmpty());
         }
     }
+
+    /**
+     *
+     */
+    static class Account {
+        /** */
+        private final int val;
+
+        /**
+         * @param val Value.
+         */
+        public Account(int val) {
+            this.val = val;
+        }
+
+        /**
+         * @return Value.
+         */
+        public int value() {
+            return val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Account.class, this);
+        }
+    }
 }


[09/14] ignite git commit: ignite-3484

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


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

Branch: refs/heads/ignite-3484
Commit: dd0afb28466094b801506da8afa3601bfaebd853
Parents: e3bba83
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 6 10:30:04 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 6 11:11:12 2017 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheOffheapManagerImpl.java    | 10 ++++-
 .../mvcc/CacheCoordinatorsSharedManager.java    |  6 ++-
 .../cache/tree/AbstractDataInnerIO.java         | 44 ++++++++++++++++----
 .../cache/tree/AbstractDataLeafIO.java          | 19 +++++++--
 .../cache/tree/CacheDataRowStore.java           | 34 ++++++++++++++-
 .../processors/cache/tree/CacheDataTree.java    |  7 +---
 .../processors/cache/tree/MvccDataRow.java      | 25 ++++++++++-
 .../processors/cache/tree/MvccSearchRow.java    | 14 +++++--
 8 files changed, 133 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dd0afb28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index 19a940d..ed52b85 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -1552,9 +1552,17 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
 
             int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID;
 
-            CacheDataRow row = dataTree.findOne(new MvccSearchRow(cacheId, key, topVer, mvccCntr),
+            // TODO IGNITE-3484: need special findCeiling method.
+
+            GridCursor<CacheDataRow> cur = dataTree.find(new MvccSearchRow(cacheId, key, topVer, mvccCntr),
+                null,
                 CacheDataRowAdapter.RowData.NO_KEY);
 
+            CacheDataRow row = null;
+
+            if (cur.next())
+                row = cur.get();
+
             afterRowFound(row, key);
 
             return row;

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd0afb28/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 2657ea5..807d18a 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
@@ -79,6 +79,10 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
         cctx.gridIO().addMessageListener(TOPIC_CACHE_COORDINATOR, new CoordinatorMessageListener());
     }
 
+    /**
+     * @param txVer Tx version.
+     * @return Counter.
+     */
     public long requestTxCounterOnCoordinator(GridCacheVersion txVer) {
         assert cctx.localNode().equals(assignHist.currentCoordinator());
 
@@ -360,7 +364,7 @@ public class CacheCoordinatorsSharedManager<K, V> extends GridCacheSharedManager
      */
     private long assignQueryCounter(UUID qryNodeId) {
         // TODO IGNITE-3478
-        return committedCntr.get() + 1;
+        return 3;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd0afb28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
index 489fd02..0b4664e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
@@ -75,25 +75,55 @@ public abstract class AbstractDataInnerIO extends BPlusInnerIO<CacheSearchRow> i
         int hash = getHash(pageAddr, idx);
         long link = getLink(pageAddr, idx);
 
+        if (storeMvccVersion()) {
+            long mvccTopVer = getMvccUpdateTopologyVersion(pageAddr, idx);
+            long mvccCntr = getMvccUpdateCounter(pageAddr, idx);
+
+            return ((CacheDataTree)tree).rowStore().mvccKeySearchRow(cacheId, hash, link, mvccTopVer, mvccCntr);
+        }
+
         return ((CacheDataTree)tree).rowStore().keySearchRow(cacheId, hash, link);
     }
 
     /** {@inheritDoc} */
-    @Override public void store(long dstPageAddr, int dstIdx, BPlusIO<CacheSearchRow> srcIo, long srcPageAddr,
-                                int srcIdx) {
-        int hash = ((RowLinkIO)srcIo).getHash(srcPageAddr, srcIdx);
-        long link = ((RowLinkIO)srcIo).getLink(srcPageAddr, srcIdx);
+    @Override public void store(long dstPageAddr,
+        int dstIdx,
+        BPlusIO<CacheSearchRow> srcIo,
+        long srcPageAddr,
+        int srcIdx)
+    {
+        RowLinkIO rowIo = ((RowLinkIO)srcIo);
+
+        int hash = rowIo.getHash(srcPageAddr, srcIdx);
+        long link =rowIo.getLink(srcPageAddr, srcIdx);
         int off = offset(dstIdx);
 
         PageUtils.putLong(dstPageAddr, off, link);
-        PageUtils.putInt(dstPageAddr, off + 8, hash);
+        off += 8;
+
+        PageUtils.putInt(dstPageAddr, off, hash);
+        off += 4;
 
         if (storeCacheId()) {
-            int cacheId = ((RowLinkIO)srcIo).getCacheId(srcPageAddr, srcIdx);
+            int cacheId = rowIo.getCacheId(srcPageAddr, srcIdx);
 
             assert cacheId != CU.UNDEFINED_CACHE_ID;
 
-            PageUtils.putInt(dstPageAddr, off + 12, cacheId);
+            PageUtils.putInt(dstPageAddr, off, cacheId);
+            off += 4;
+        }
+
+        if (storeMvccVersion()) {
+            long mvccTopVer = rowIo.getMvccUpdateTopologyVersion(srcPageAddr, srcIdx);
+            long mvcCntr = rowIo.getMvccUpdateCounter(srcPageAddr, srcIdx);
+
+            assert mvccTopVer > 0 : mvccTopVer;
+            assert mvcCntr != TxMvccVersion.COUNTER_NA;
+
+            PageUtils.putLong(dstPageAddr, off, mvccTopVer);
+            off += 8;
+
+            PageUtils.putLong(dstPageAddr, off, mvcCntr);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd0afb28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
index 5b94a15..d496103 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
@@ -108,10 +108,21 @@ public abstract class AbstractDataLeafIO extends BPlusLeafIO<CacheSearchRow> imp
     }
 
     /** {@inheritDoc} */
-    @Override public CacheSearchRow getLookupRow(BPlusTree<CacheSearchRow, ?> tree, long buf, int idx) {
-        int cacheId = getCacheId(buf, idx);
-        int hash = getHash(buf, idx);
-        long link = getLink(buf, idx);
+    @Override public CacheSearchRow getLookupRow(BPlusTree<CacheSearchRow, ?> tree, long pageAddr, int idx) {
+        int cacheId = getCacheId(pageAddr, idx);
+        int hash = getHash(pageAddr, idx);
+        long link = getLink(pageAddr, idx);
+
+        if (storeMvccVersion()) {
+            long mvccTopVer = getMvccUpdateTopologyVersion(pageAddr, idx);
+            long mvccCntr = getMvccUpdateCounter(pageAddr, idx);
+
+            return ((CacheDataTree)tree).rowStore().mvccKeySearchRow(cacheId,
+                hash,
+                link,
+                mvccTopVer,
+                mvccCntr);
+        }
 
         return ((CacheDataTree)tree).rowStore().keySearchRow(cacheId, hash, link);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd0afb28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java
index 28d8919..6774d3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java
@@ -56,13 +56,43 @@ public class CacheDataRowStore extends RowStore {
     CacheSearchRow keySearchRow(int cacheId, int hash, long link) {
         DataRow dataRow = new DataRow(grp, hash, link, partId, CacheDataRowAdapter.RowData.KEY_ONLY);
 
-        if (dataRow.cacheId() == CU.UNDEFINED_CACHE_ID && grp.sharedGroup())
-            dataRow.cacheId(cacheId);
+        initDataRow(dataRow, cacheId);
+
+        return dataRow;
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param hash Hash code.
+     * @param link Link.
+     * @param mvccTopVer
+     * @param mvccCntr
+     * @return Search row.
+     */
+    CacheSearchRow mvccKeySearchRow(int cacheId, int hash, long link, long mvccTopVer, long mvccCntr) {
+        MvccDataRow dataRow = new MvccDataRow(grp,
+            hash,
+            link,
+            partId,
+            CacheDataRowAdapter.RowData.KEY_ONLY,
+            mvccTopVer,
+            mvccCntr);
+
+        initDataRow(dataRow, cacheId);
 
         return dataRow;
     }
 
     /**
+     * @param dataRow Data row.
+     * @param cacheId Cache ID.
+     */
+    private void initDataRow(DataRow dataRow, int cacheId) {
+        if (dataRow.cacheId() == CU.UNDEFINED_CACHE_ID && grp.sharedGroup())
+            dataRow.cacheId(cacheId);
+    }
+
+    /**
      * @param cacheId Cache ID.
      * @param hash Hash code.
      * @param link Link.

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd0afb28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
index 99b1372..e846768 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
@@ -114,6 +114,8 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow> {
     /** {@inheritDoc} */
     @Override protected int compare(BPlusIO<CacheSearchRow> iox, long pageAddr, int idx, CacheSearchRow row)
         throws IgniteCheckedException {
+        assert !grp.mvccEnabled() || row.mvccUpdateTopologyVersion() != 0 || row.getClass() == SearchRow.class;
+
         RowLinkIO io = (RowLinkIO)iox;
 
         int cmp;
@@ -185,11 +187,6 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow> {
             (CacheDataRowAdapter.RowData)flags :
             CacheDataRowAdapter.RowData.FULL;
 
-//        if (grp.mvccEnabled()) {
-//            long mvccTopVer = rowIo.getMvccUpdateTopologyVersion(pageAddr, idx);
-//            long mvcCntr = rowIo.getMvccUpdateCounter(pageAddr, idx);
-//        }
-
         return rowStore.dataRow(cacheId, hash, link, x);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd0afb28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataRow.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataRow.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataRow.java
index 1ab86ca..484e5f1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataRow.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataRow.java
@@ -17,8 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.tree;
 
+import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccVersion;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 
 /**
@@ -26,10 +28,29 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
  */
 public class MvccDataRow extends DataRow {
     /** */
-    private long mvccCntr;
+    private long mvccTopVer;
 
     /** */
-    private long mvccTopVer;
+    private long mvccCntr;
+
+    /**
+     * @param grp
+     * @param hash
+     * @param link
+     * @param part
+     * @param rowData
+     * @param mvccTopVer
+     * @param mvccCntr
+     */
+    public MvccDataRow(CacheGroupContext grp, int hash, long link, int part, RowData rowData, long mvccTopVer, long mvccCntr) {
+        super(grp, hash, link, part, rowData);
+
+        assert mvccTopVer > 0 : mvccTopVer;
+        assert mvccCntr != TxMvccVersion.COUNTER_NA;
+
+        this.mvccTopVer = mvccTopVer;
+        this.mvccCntr = mvccCntr;
+    }
 
     /**
      * @param key

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd0afb28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccSearchRow.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccSearchRow.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccSearchRow.java
index da235ab..ae3da98 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccSearchRow.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccSearchRow.java
@@ -29,6 +29,12 @@ public class MvccSearchRow extends SearchRow {
     /** */
     private long mvccCntr;
 
+    /**
+     * @param cacheId
+     * @param key
+     * @param mvccTopVer
+     * @param mvccCntr
+     */
     public MvccSearchRow(int cacheId, KeyCacheObject key, long mvccTopVer, long mvccCntr) {
         super(cacheId, key);
 
@@ -37,12 +43,12 @@ public class MvccSearchRow extends SearchRow {
     }
 
     /** {@inheritDoc} */
-    @Override public long mvccUpdateCounter() {
-        return super.mvccUpdateCounter();
+    @Override public long mvccUpdateTopologyVersion() {
+        return mvccTopVer;
     }
 
     /** {@inheritDoc} */
-    @Override public long mvccUpdateTopologyVersion() {
-        return super.mvccUpdateTopologyVersion();
+    @Override public long mvccUpdateCounter() {
+        return mvccCntr;
     }
 }


[11/14] 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/distributed/dht/GridDhtTxPrepareFuture.java


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

Branch: refs/heads/ignite-3484
Commit: 27b87b413348b03986a463551db24b7726321732
Parents: 43834aa 788adc0
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 6 11:19:18 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 6 11:19:18 2017 +0300

----------------------------------------------------------------------
 .../jdbc/thin/JdbcThinStatementSelfTest.java    |  62 ++++-
 .../java/org/apache/ignite/IgniteServices.java  |   2 +-
 .../internal/jdbc/thin/JdbcThinResultSet.java   |  29 ++-
 .../internal/jdbc/thin/JdbcThinStatement.java   |  22 +-
 .../cache/CacheAffinitySharedManager.java       |  17 +-
 .../GridCachePartitionExchangeManager.java      |   5 +-
 .../dht/GridClientPartitionTopology.java        |   3 +
 .../cache/distributed/dht/GridDhtTxLocal.java   |   1 -
 .../distributed/dht/GridDhtTxPrepareFuture.java |  19 +-
 .../GridDhtPartitionsExchangeFuture.java        |  10 +-
 .../odbc/SqlListenerConnectionContext.java      |  37 ++-
 .../processors/odbc/SqlListenerNioListener.java |  95 ++------
 .../odbc/jdbc/JdbcConnectionContext.java        | 101 ++++++++
 .../odbc/odbc/OdbcConnectionContext.java        |  99 ++++++++
 .../odbc/odbc/OdbcRequestHandler.java           |  54 +++--
 .../GridServiceDeploymentCompoundFuture.java    |   1 +
 .../service/GridServiceProcessor.java           |   1 +
 .../service/ServiceDeploymentException.java     |  78 ------
 .../services/ServiceDeploymentException.java    |  77 ++++++
 .../org.apache.ignite.plugin.PluginProvider     |   3 +-
 ...atformCachePluginConfigurationClosureFactory |   1 -
 ...rm.PlatformPluginConfigurationClosureFactory |   1 -
 ...ServiceDeploymentCompoundFutureSelfTest.java |   1 +
 ...GridServiceProcessorBatchDeploySelfTest.java |   1 +
 .../platform/plugin/PlatformTestPlugin.java     |  27 ---
 .../plugin/PlatformTestPluginConfiguration.java |  63 -----
 ...rmTestPluginConfigurationClosureFactory.java |  61 -----
 .../plugin/PlatformTestPluginException.java     |  34 ---
 .../plugin/PlatformTestPluginExtension.java     |  51 ----
 .../plugin/PlatformTestPluginProvider.java      | 103 --------
 .../plugin/PlatformTestPluginTarget.java        | 236 -------------------
 .../cache/PlatformGetCachePluginsTask.java      |  85 -------
 .../PlatformTestCachePluginConfiguration.java   |  55 -----
 ...formTestCachePluginConfigurationClosure.java |  48 ----
 ...tCachePluginConfigurationClosureFactory.java |  37 ---
 .../cache/PlatformTestCachePluginProvider.java  |  72 ------
 modules/extdata/platform/README.txt             |   4 +
 .../extdata/platform/licenses/apache-2.0.txt    | 202 ++++++++++++++++
 modules/extdata/platform/pom.xml                |  46 ++++
 .../platform/plugin/PlatformTestPlugin.java     |  27 +++
 .../plugin/PlatformTestPluginConfiguration.java |  63 +++++
 ...rmTestPluginConfigurationClosureFactory.java |  61 +++++
 .../plugin/PlatformTestPluginException.java     |  34 +++
 .../plugin/PlatformTestPluginExtension.java     |  51 ++++
 .../plugin/PlatformTestPluginProvider.java      | 103 ++++++++
 .../plugin/PlatformTestPluginTarget.java        | 236 +++++++++++++++++++
 .../cache/PlatformGetCachePluginsTask.java      |  85 +++++++
 .../PlatformTestCachePluginConfiguration.java   |  55 +++++
 ...formTestCachePluginConfigurationClosure.java |  48 ++++
 ...tCachePluginConfigurationClosureFactory.java |  37 +++
 .../cache/PlatformTestCachePluginProvider.java  |  72 ++++++
 .../platform/plugin/cache/package-info.java     |  22 ++
 .../ignite/platform/plugin/package-info.java    |  22 ++
 .../org.apache.ignite.plugin.PluginProvider     |   1 +
 ...atformCachePluginConfigurationClosureFactory |   1 +
 ...rm.PlatformPluginConfigurationClosureFactory |   1 +
 .../DynamicIndexAbstractConcurrentSelfTest.java |   2 +-
 .../cpp/odbc-test/src/configuration_test.cpp    |  11 +
 .../include/ignite/odbc/config/configuration.h  |  26 ++
 .../cpp/odbc/include/ignite/odbc/message.h      |   6 +-
 .../odbc/include/ignite/odbc/protocol_version.h |   1 +
 .../odbc/system/ui/dsn_configuration_window.h   |   4 +
 .../src/system/ui/dsn_configuration_window.cpp  |  34 ++-
 .../cpp/odbc/src/config/configuration.cpp       |   2 +
 modules/platforms/cpp/odbc/src/connection.cpp   |   6 +-
 modules/platforms/cpp/odbc/src/dsn_config.cpp   |   3 +
 modules/platforms/cpp/odbc/src/message.cpp      |  15 +-
 .../platforms/cpp/odbc/src/protocol_version.cpp |   8 +-
 .../Apache.Ignite.Core/Impl/Common/Classpath.cs |   1 +
 pom.xml                                         |   1 +
 70 files changed, 1776 insertions(+), 1107 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/27b87b41/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 3bb4ea8,1c5e1a6..5ac86da
--- 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
@@@ -1263,44 -1236,18 +1263,55 @@@ public final class GridDhtTxPrepareFutu
              if (isDone())
                  return;
  
-             if (last) {
-                 if (waitCrdCntrFut != null) {
+             if (last)
+                 sendPrepareRequests();
+         }
+         finally {
+             markInitialized();
+         }
+     }
+ 
+     /**
+      *
+      */
+     private void sendPrepareRequests() {
++        if (waitCrdCntrFut != null) {
 +                    skipInit = true;
 +
 +                    waitCrdCntrFut.listen(new IgniteInClosure<IgniteInternalFuture<Long>>() {
 +                        @Override public void apply(IgniteInternalFuture<Long> fut) {
 +                            try {
 +                                fut.get();
 +
 +                                sendPrepareRequests();
 +                            }
 +                            catch (Throwable e) {
 +                                U.error(log, "Failed to get coordinator counter: " + e, e);
 +
 +                                GridNearTxPrepareResponse res = createPrepareResponse(e);
 +
 +                                onDone(res, res.error());
 +                            }
 +                            finally {
 +                                markInitialized();
 +                            }
 +                        }
 +                    });
 +                }
 +                else
 +                    sendPrepareRequests();
 +            }
 +        }
 +        finally {
 +            if (!skipInit)
 +                markInitialized();
 +        }
 +    }
 +
 +    /**
 +     *
 +     */
 +    private void sendPrepareRequests() {
          if (tx.onePhaseCommit() && !tx.nearMap().isEmpty()) {
              for (GridDistributedTxMapping nearMapping : tx.nearMap().values()) {
                  if (!tx.dhtMap().containsKey(nearMapping.primary().id())) {
@@@ -1311,9 -1258,7 +1322,7 @@@
              }
          }
  
-         assert !tx.txState().mvccEnabled(cctx) || !tx.onePhaseCommit() || tx.mvccCoordinatorCounter() != TxMvccVersion.COUNTER_NA;
- 
--        int miniId = 0;
++                assert !tx.txState().mvccEnabled(cctx) || !tx.onePhaseCommit() || tx.mvccCoordinatorCounter() != TxMvccVersion.COUNTER_NA;int miniId = 0;
  
          assert tx.transactionNodes() != null;
  

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


[05/14] ignite git commit: IGNITE-6119: Added 'lazy' flag to ODBC driver.

Posted by sb...@apache.org.
IGNITE-6119: Added 'lazy' flag to ODBC driver.


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

Branch: refs/heads/ignite-3484
Commit: d6cbc50f8418eac2cf11ea52a8c42a24937d0bb3
Parents: d7e215d
Author: Igor Sapego <is...@gridgain.com>
Authored: Tue Sep 5 17:20:51 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Tue Sep 5 17:20:51 2017 +0300

----------------------------------------------------------------------
 .../odbc/SqlListenerConnectionContext.java      |  37 ++++---
 .../processors/odbc/SqlListenerNioListener.java |  95 +++++------------
 .../odbc/jdbc/JdbcConnectionContext.java        | 101 +++++++++++++++++++
 .../odbc/odbc/OdbcConnectionContext.java        |  99 ++++++++++++++++++
 .../odbc/odbc/OdbcRequestHandler.java           |  54 ++++++----
 .../cpp/odbc-test/src/configuration_test.cpp    |  11 ++
 .../include/ignite/odbc/config/configuration.h  |  26 +++++
 .../cpp/odbc/include/ignite/odbc/message.h      |   6 +-
 .../odbc/include/ignite/odbc/protocol_version.h |   1 +
 .../odbc/system/ui/dsn_configuration_window.h   |   4 +
 .../src/system/ui/dsn_configuration_window.cpp  |  34 ++++++-
 .../cpp/odbc/src/config/configuration.cpp       |   2 +
 modules/platforms/cpp/odbc/src/connection.cpp   |   6 +-
 modules/platforms/cpp/odbc/src/dsn_config.cpp   |   3 +
 modules/platforms/cpp/odbc/src/message.cpp      |  15 ++-
 .../platforms/cpp/odbc/src/protocol_version.cpp |   8 +-
 16 files changed, 384 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
index 759f3d4..144e978 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
@@ -17,40 +17,39 @@
 
 package org.apache.ignite.internal.processors.odbc;
 
+import org.apache.ignite.internal.binary.BinaryReaderExImpl;
+
 /**
  * SQL listener connection context.
  */
-public class SqlListenerConnectionContext {
-    /** Request handler. */
-    private final SqlListenerRequestHandler handler;
+public interface SqlListenerConnectionContext {
+    /**
+     * @param ver Version to check.
+     * @return {@code true} if version is supported.
+     */
+    boolean isVersionSupported(SqlListenerProtocolVersion ver);
 
-    /** Message parser. */
-    private final SqlListenerMessageParser parser;
+    /**
+     * @return Current context version.
+     */
+    SqlListenerProtocolVersion currentVersion();
 
     /**
-     * Constructor.
-     *
-     * @param handler Handler.
-     * @param parser Parser.
+     * Init from handshake message.
+     * @param ver Protocol version.
+     * @param reader Reader set to the configuration part of the handshake message.
      */
-    public SqlListenerConnectionContext(SqlListenerRequestHandler handler, SqlListenerMessageParser parser) {
-        this.handler = handler;
-        this.parser = parser;
-    }
+    void initFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader);
 
     /**
      * Handler getter.
      * @return Request handler for the connection.
      */
-    public SqlListenerRequestHandler handler() {
-        return handler;
-    }
+    SqlListenerRequestHandler handler();
 
     /**
      * Parser getter
      * @return Message parser for the connection.
      */
-    public SqlListenerMessageParser parser() {
-        return parser;
-    }
+    SqlListenerMessageParser parser();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
index 8dad71b..ec7d4eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.internal.processors.odbc;
 
-import java.util.HashSet;
-import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
@@ -28,10 +26,8 @@ import org.apache.ignite.internal.binary.BinaryWriterExImpl;
 import org.apache.ignite.internal.binary.streams.BinaryHeapInputStream;
 import org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream;
 import org.apache.ignite.internal.binary.streams.BinaryInputStream;
-import org.apache.ignite.internal.processors.odbc.jdbc.JdbcMessageParser;
-import org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler;
-import org.apache.ignite.internal.processors.odbc.odbc.OdbcMessageParser;
-import org.apache.ignite.internal.processors.odbc.odbc.OdbcRequestHandler;
+import org.apache.ignite.internal.processors.odbc.jdbc.JdbcConnectionContext;
+import org.apache.ignite.internal.processors.odbc.odbc.OdbcConnectionContext;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.nio.GridNioServerListenerAdapter;
 import org.apache.ignite.internal.util.nio.GridNioSession;
@@ -48,18 +44,6 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
     /** The value corresponds to JDBC driver of the parser field of the handshake request. */
     public static final byte JDBC_CLIENT = 1;
 
-    /** Version 2.1.0. */
-    private static final SqlListenerProtocolVersion VER_2_1_0 = SqlListenerProtocolVersion.create(2, 1, 0);
-
-    /** Version 2.1.5: added "lazy" flag. */
-    private static final SqlListenerProtocolVersion VER_2_1_5 = SqlListenerProtocolVersion.create(2, 1, 5);
-
-    /** Current version. */
-    private static final SqlListenerProtocolVersion CURRENT_VER = VER_2_1_5;
-
-    /** Supported versions. */
-    private static final Set<SqlListenerProtocolVersion> SUPPORTED_VERS = new HashSet<>();
-
     /** Connection-related metadata key. */
     private static final int CONN_CTX_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
 
@@ -78,11 +62,6 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
     /** Logger. */
     private final IgniteLogger log;
 
-    static {
-        SUPPORTED_VERS.add(CURRENT_VER);
-        SUPPORTED_VERS.add(VER_2_1_0);
-    }
-
     /**
      * Constructor.
      *
@@ -152,8 +131,8 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
             if (log.isDebugEnabled()) {
                 startTime = System.nanoTime();
 
-                log.debug("SQL client request received [reqId=" + req.requestId() + ", addr=" + ses.remoteAddress() +
-                    ", req=" + req + ']');
+                log.debug("SQL client request received [reqId=" + req.requestId() + ", addr=" +
+                    ses.remoteAddress() + ", req=" + req + ']');
             }
 
             SqlListenerResponse resp = handler.handle(req);
@@ -203,13 +182,14 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
 
         SqlListenerProtocolVersion ver = SqlListenerProtocolVersion.create(verMajor, verMinor, verMaintenance);
 
-        String errMsg = null;
+        byte clientType = reader.readByte();
 
-        SqlListenerConnectionContext connCtx = null;
+        SqlListenerConnectionContext connCtx = prepareContext(clientType);
+
+        String errMsg = null;
 
-        if (SUPPORTED_VERS.contains(ver)) {
-            // Prepare context.
-            connCtx = prepareContext(ver, reader);
+        if (connCtx.isVersionSupported(ver)) {
+            connCtx.initFromHandshake(ver, reader);
 
             ses.addMeta(CONN_CTX_META_KEY, connCtx);
         }
@@ -222,14 +202,16 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
         // Send response.
         BinaryWriterExImpl writer = new BinaryWriterExImpl(null, new BinaryHeapOutputStream(8), null, null);
 
-        if (connCtx != null)
+        if (errMsg == null)
             connCtx.handler().writeHandshake(writer);
         else {
+            SqlListenerProtocolVersion currentVer = connCtx.currentVersion();
+
             // Failed handshake response
             writer.writeBoolean(false);
-            writer.writeShort(CURRENT_VER.major());
-            writer.writeShort(CURRENT_VER.minor());
-            writer.writeShort(CURRENT_VER.maintenance());
+            writer.writeShort(currentVer.major());
+            writer.writeShort(currentVer.minor());
+            writer.writeShort(currentVer.maintenance());
             writer.doWriteString(errMsg);
         }
 
@@ -239,46 +221,19 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
     /**
      * Prepare context.
      *
-     * @param ver Version.
-     * @param reader Reader.
+     * @param clientType Client type.
      * @return Context.
      */
-    private SqlListenerConnectionContext prepareContext(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader) {
-        byte clientType = reader.readByte();
-
-        if (clientType == ODBC_CLIENT) {
-            boolean distributedJoins = reader.readBoolean();
-            boolean enforceJoinOrder = reader.readBoolean();
-            boolean replicatedOnly = reader.readBoolean();
-            boolean collocated = reader.readBoolean();
-
-            SqlListenerRequestHandler handler = new OdbcRequestHandler(ctx, busyLock, maxCursors, distributedJoins,
-                enforceJoinOrder, replicatedOnly, collocated);
-
-            SqlListenerMessageParser parser = new OdbcMessageParser(ctx);
-
-            return new SqlListenerConnectionContext(handler, parser);
-        }
-        else if (clientType == JDBC_CLIENT) {
-            boolean distributedJoins = reader.readBoolean();
-            boolean enforceJoinOrder = reader.readBoolean();
-            boolean collocated = reader.readBoolean();
-            boolean replicatedOnly = reader.readBoolean();
-            boolean autoCloseCursors = reader.readBoolean();
-
-            boolean lazyExec = false;
-
-            if (ver.compareTo(VER_2_1_5) >= 0)
-                lazyExec = reader.readBoolean();
-
-            SqlListenerRequestHandler handler = new JdbcRequestHandler(ctx, busyLock, maxCursors, distributedJoins,
-                enforceJoinOrder, collocated, replicatedOnly, autoCloseCursors, lazyExec);
+    private SqlListenerConnectionContext prepareContext(byte clientType) {
+        switch (clientType) {
+            case ODBC_CLIENT:
+                return new OdbcConnectionContext(ctx, busyLock, maxCursors);
 
-            SqlListenerMessageParser parser = new JdbcMessageParser(ctx);
+            case JDBC_CLIENT:
+                return new JdbcConnectionContext(ctx, busyLock, maxCursors);
 
-            return new SqlListenerConnectionContext(handler, parser);
+            default:
+                throw new IgniteException("Unknown client type: " + clientType);
         }
-        else
-            throw new IgniteException("Unknown client type: " + clientType);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
new file mode 100644
index 0000000..89f90f0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
@@ -0,0 +1,101 @@
+package org.apache.ignite.internal.processors.odbc.jdbc;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryReaderExImpl;
+import org.apache.ignite.internal.processors.odbc.SqlListenerConnectionContext;
+import org.apache.ignite.internal.processors.odbc.SqlListenerMessageParser;
+import org.apache.ignite.internal.processors.odbc.SqlListenerProtocolVersion;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequestHandler;
+import org.apache.ignite.internal.util.GridSpinBusyLock;
+
+/**
+ * ODBC Connection Context.
+ */
+public class JdbcConnectionContext implements SqlListenerConnectionContext {
+    /** Version 2.1.0. */
+    private static final SqlListenerProtocolVersion VER_2_1_0 = SqlListenerProtocolVersion.create(2, 1, 0);
+
+    /** Version 2.1.5: added "lazy" flag. */
+    private static final SqlListenerProtocolVersion VER_2_1_5 = SqlListenerProtocolVersion.create(2, 1, 5);
+
+    /** Current version. */
+    private static final SqlListenerProtocolVersion CURRENT_VER = VER_2_1_5;
+
+    /** Supported versions. */
+    private static final Set<SqlListenerProtocolVersion> SUPPORTED_VERS = new HashSet<>();
+
+    /** Context. */
+    private final GridKernalContext ctx;
+
+    /** Shutdown busy lock. */
+    private final GridSpinBusyLock busyLock;
+
+    /** Maximum allowed cursors. */
+    private final int maxCursors;
+
+    /** Message parser. */
+    private JdbcMessageParser parser = null;
+
+    /** Request handler. */
+    private JdbcRequestHandler handler = null;
+
+    static {
+        SUPPORTED_VERS.add(CURRENT_VER);
+        SUPPORTED_VERS.add(VER_2_1_0);
+    }
+
+    @Override
+    public boolean isVersionSupported(SqlListenerProtocolVersion ver) {
+        return SUPPORTED_VERS.contains(ver);
+    }
+
+    @Override
+    public SqlListenerProtocolVersion currentVersion() {
+        return CURRENT_VER;
+    }
+
+    @Override
+    public void initFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader) {
+        assert SUPPORTED_VERS.contains(ver): "Unsupported JDBC protocol version.";
+
+        boolean distributedJoins = reader.readBoolean();
+        boolean enforceJoinOrder = reader.readBoolean();
+        boolean collocated = reader.readBoolean();
+        boolean replicatedOnly = reader.readBoolean();
+        boolean autoCloseCursors = reader.readBoolean();
+
+        boolean lazyExec = false;
+
+        if (ver.compareTo(VER_2_1_5) >= 0)
+            lazyExec = reader.readBoolean();
+
+        handler = new JdbcRequestHandler(ctx, busyLock, maxCursors, distributedJoins,
+                enforceJoinOrder, collocated, replicatedOnly, autoCloseCursors, lazyExec);
+
+        parser = new JdbcMessageParser(ctx);
+    }
+
+    /**
+     * Constructor.
+     * @param ctx Kernal Context.
+     * @param busyLock Shutdown busy lock.
+     * @param maxCursors Maximum allowed cursors.
+     */
+    public JdbcConnectionContext(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
+        this.ctx = ctx;
+        this.busyLock = busyLock;
+        this.maxCursors = maxCursors;
+    }
+
+    @Override
+    public SqlListenerRequestHandler handler() {
+        return handler;
+    }
+
+    @Override
+    public SqlListenerMessageParser parser() {
+        return parser;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
new file mode 100644
index 0000000..4e9dfbb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
@@ -0,0 +1,99 @@
+package org.apache.ignite.internal.processors.odbc.odbc;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryReaderExImpl;
+import org.apache.ignite.internal.processors.odbc.SqlListenerConnectionContext;
+import org.apache.ignite.internal.processors.odbc.SqlListenerMessageParser;
+import org.apache.ignite.internal.processors.odbc.SqlListenerProtocolVersion;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequestHandler;
+import org.apache.ignite.internal.util.GridSpinBusyLock;
+
+/**
+ * ODBC Connection Context.
+ */
+public class OdbcConnectionContext implements SqlListenerConnectionContext {
+    /** Version 2.1.0. */
+    private static final SqlListenerProtocolVersion VER_2_1_0 = SqlListenerProtocolVersion.create(2, 1, 0);
+
+    /** Version 2.1.5: added "lazy" flag. */
+    private static final SqlListenerProtocolVersion VER_2_1_5 = SqlListenerProtocolVersion.create(2, 1, 5);
+
+    /** Current version. */
+    private static final SqlListenerProtocolVersion CURRENT_VER = VER_2_1_5;
+
+    /** Supported versions. */
+    private static final Set<SqlListenerProtocolVersion> SUPPORTED_VERS = new HashSet<>();
+
+    /** Context. */
+    private final GridKernalContext ctx;
+
+    /** Shutdown busy lock. */
+    private final GridSpinBusyLock busyLock;
+
+    /** Maximum allowed cursors. */
+    private final int maxCursors;
+
+    /** Message parser. */
+    private OdbcMessageParser parser = null;
+
+    /** Request handler. */
+    private OdbcRequestHandler handler = null;
+
+    static {
+        SUPPORTED_VERS.add(CURRENT_VER);
+        SUPPORTED_VERS.add(VER_2_1_0);
+    }
+
+    @Override
+    public boolean isVersionSupported(SqlListenerProtocolVersion ver) {
+        return SUPPORTED_VERS.contains(ver);
+    }
+
+    @Override
+    public SqlListenerProtocolVersion currentVersion() {
+        return CURRENT_VER;
+    }
+
+    @Override
+    public void initFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader) {
+        assert SUPPORTED_VERS.contains(ver): "Unsupported ODBC protocol version.";
+
+        boolean distributedJoins = reader.readBoolean();
+        boolean enforceJoinOrder = reader.readBoolean();
+        boolean replicatedOnly = reader.readBoolean();
+        boolean collocated = reader.readBoolean();
+        boolean lazy = false;
+
+        if (ver.compareTo(VER_2_1_5) >= 0)
+            lazy = reader.readBoolean();
+
+        handler = new OdbcRequestHandler(ctx, busyLock, maxCursors, distributedJoins,
+                enforceJoinOrder, replicatedOnly, collocated, lazy);
+
+        parser = new OdbcMessageParser(ctx);
+    }
+
+    /**
+     * Constructor.
+     * @param ctx Kernal Context.
+     * @param busyLock Shutdown busy lock.
+     * @param maxCursors Maximum allowed cursors.
+     */
+    public OdbcConnectionContext(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
+        this.ctx = ctx;
+        this.busyLock = busyLock;
+        this.maxCursors = maxCursors;
+    }
+
+    @Override
+    public SqlListenerRequestHandler handler() {
+        return handler;
+    }
+
+    @Override
+    public SqlListenerMessageParser parser() {
+        return parser;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
index 679a2e6..1aa4309 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
@@ -27,7 +27,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
-
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cache.query.QueryCursor;
@@ -48,7 +47,13 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 
-import static org.apache.ignite.internal.processors.odbc.odbc.OdbcRequest.*;
+import static org.apache.ignite.internal.processors.odbc.odbc.OdbcRequest.META_COLS;
+import static org.apache.ignite.internal.processors.odbc.odbc.OdbcRequest.META_PARAMS;
+import static org.apache.ignite.internal.processors.odbc.odbc.OdbcRequest.META_TBLS;
+import static org.apache.ignite.internal.processors.odbc.odbc.OdbcRequest.QRY_CLOSE;
+import static org.apache.ignite.internal.processors.odbc.odbc.OdbcRequest.QRY_EXEC;
+import static org.apache.ignite.internal.processors.odbc.odbc.OdbcRequest.QRY_EXEC_BATCH;
+import static org.apache.ignite.internal.processors.odbc.odbc.OdbcRequest.QRY_FETCH;
 
 /**
  * SQL query handler.
@@ -84,6 +89,9 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
     /** Collocated flag. */
     private final boolean collocated;
 
+    /** Lazy flag. */
+    private final boolean lazy;
+
     /**
      * Constructor.
      * @param ctx Context.
@@ -93,10 +101,11 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
      * @param enforceJoinOrder Enforce join order flag.
      * @param replicatedOnly Replicated only flag.
      * @param collocated Collocated flag.
+     * @param lazy Lazy flag.
      */
     public OdbcRequestHandler(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors,
                               boolean distributedJoins, boolean enforceJoinOrder, boolean replicatedOnly,
-                              boolean collocated) {
+                              boolean collocated, boolean lazy) {
         this.ctx = ctx;
         this.busyLock = busyLock;
         this.maxCursors = maxCursors;
@@ -104,6 +113,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
         this.enforceJoinOrder = enforceJoinOrder;
         this.replicatedOnly = replicatedOnly;
         this.collocated = collocated;
+        this.lazy = lazy;
 
         log = ctx.log(getClass());
     }
@@ -160,6 +170,28 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
     }
 
     /**
+     * Make query considering handler configuration.
+     * @param schema Schema.
+     * @param sql SQL request.
+     * @param args Arguments.
+     * @return Query instance.
+     */
+    private SqlFieldsQuery makeQuery(String schema, String sql, Object[] args) {
+        SqlFieldsQuery qry = new SqlFieldsQuery(sql);
+
+        qry.setArgs(args);
+
+        qry.setDistributedJoins(distributedJoins);
+        qry.setEnforceJoinOrder(enforceJoinOrder);
+        qry.setReplicatedOnly(replicatedOnly);
+        qry.setCollocated(collocated);
+        qry.setLazy(lazy);
+        qry.setSchema(schema);
+
+        return qry;
+    }
+
+    /**
      * {@link OdbcQueryExecuteRequest} command handler.
      *
      * @param req Execute query request.
@@ -182,15 +214,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
                 log.debug("ODBC query parsed [reqId=" + req.requestId() + ", original=" + req.sqlQuery() +
                     ", parsed=" + sql + ']');
 
-            SqlFieldsQuery qry = new SqlFieldsQuery(sql);
-
-            qry.setArgs(req.arguments());
-
-            qry.setDistributedJoins(distributedJoins);
-            qry.setEnforceJoinOrder(enforceJoinOrder);
-            qry.setReplicatedOnly(replicatedOnly);
-            qry.setCollocated(collocated);
-            qry.setSchema(req.schema());
+            SqlFieldsQuery qry = makeQuery(req.schema(), sql, req.arguments());
 
             QueryCursor qryCur = ctx.query().querySqlFieldsNoCache(qry, true);
 
@@ -228,11 +252,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
                 log.debug("ODBC query parsed [reqId=" + req.requestId() + ", original=" + req.sqlQuery() +
                         ", parsed=" + sql + ']');
 
-            SqlFieldsQuery qry = new SqlFieldsQuery(sql);
-
-            qry.setDistributedJoins(distributedJoins);
-            qry.setEnforceJoinOrder(enforceJoinOrder);
-            qry.setSchema(req.schema());
+            SqlFieldsQuery qry = makeQuery(req.schema(), sql, req.arguments());
 
             Object[][] paramSet = req.arguments();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
index d00d8b3..7da6757 100644
--- a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
@@ -42,6 +42,7 @@ namespace
     const bool testEnforceJoinOrder = true;
     const bool testReplicatedOnly = true;
     const bool testCollocated = true;
+    const bool testLazy = true;
 
     const std::string testAddress = testServerHost + ':' + ignite::common::LexicalCast<std::string>(testServerPort);
 }
@@ -130,6 +131,7 @@ void CheckConnectionConfig(const Configuration& cfg)
     BOOST_CHECK_EQUAL(cfg.IsEnforceJoinOrder(), testEnforceJoinOrder);
     BOOST_CHECK_EQUAL(cfg.IsReplicatedOnly(), testReplicatedOnly);
     BOOST_CHECK_EQUAL(cfg.IsCollocated(), testCollocated);
+    BOOST_CHECK_EQUAL(cfg.IsLazy(), testLazy);
 
     std::stringstream constructor;
 
@@ -138,6 +140,7 @@ void CheckConnectionConfig(const Configuration& cfg)
                 << "distributed_joins=" << BoolToStr(testDistributedJoins) << ';'
                 << "driver={" << testDriverName << "};"
                 << "enforce_join_order=" << BoolToStr(testEnforceJoinOrder) << ';'
+                << "lazy=" << BoolToStr(testLazy) << ';'
                 << "page_size=" << testPageSize << ';'
                 << "replicated_only=" << BoolToStr(testReplicatedOnly) << ';'
                 << "schema=" << testSchemaName << ';';
@@ -160,6 +163,7 @@ void CheckDsnConfig(const Configuration& cfg)
     BOOST_CHECK_EQUAL(cfg.IsEnforceJoinOrder(), false);
     BOOST_CHECK_EQUAL(cfg.IsReplicatedOnly(), false);
     BOOST_CHECK_EQUAL(cfg.IsCollocated(), false);
+    BOOST_CHECK_EQUAL(cfg.IsLazy(), false);
 }
 
 BOOST_AUTO_TEST_SUITE(ConfigurationTestSuite)
@@ -185,6 +189,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringUppercase)
     std::stringstream constructor;
 
     constructor << "DRIVER={" << testDriverName << "};"
+                << "LAZY=" << BoolToStr(testLazy, false) << ';'
                 << "ADDRESS=" << testAddress << ';'
                 << "DISTRIBUTED_JOINS=" << BoolToStr(testDistributedJoins, false) << ';'
                 << "ENFORCE_JOIN_ORDER=" << BoolToStr(testEnforceJoinOrder, false) << ';'
@@ -207,6 +212,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringLowercase)
     std::stringstream constructor;
 
     constructor << "driver={" << testDriverName << "};"
+                << "lazy=" << BoolToStr(testLazy) << ';'
                 << "address=" << testAddress << ';'
                 << "page_size=" << testPageSize << ';'
                 << "distributed_joins=" << BoolToStr(testDistributedJoins) << ';'
@@ -230,6 +236,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringZeroTerminated)
 
     constructor << "driver={" << testDriverName << "};"
                 << "address=" << testAddress << ';'
+                << "lazy=" << BoolToStr(testLazy) << ';'
                 << "page_size=" << testPageSize << ';'
                 << "replicated_only=" << BoolToStr(testReplicatedOnly) << ';'
                 << "collocated=" << BoolToStr(testCollocated) << ';'
@@ -251,6 +258,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringMixed)
     std::stringstream constructor;
 
     constructor << "Driver={" << testDriverName << "};"
+                << "Lazy=" << BoolToStr(testLazy) << ';'
                 << "Address=" << testAddress << ';'
                 << "Page_Size=" << testPageSize << ';'
                 << "Distributed_Joins=" << BoolToStr(testDistributedJoins, false) << ';'
@@ -276,6 +284,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringWhitepaces)
                 << " ADDRESS =" << testAddress << "; "
                 << "   PAGE_SIZE= " << testPageSize << ';'
                 << "   DISTRIBUTED_JOINS=" << BoolToStr(testDistributedJoins, false) << ';'
+                << "LAZY=" << BoolToStr(testLazy, false) << ';'
                 << "COLLOCATED    =" << BoolToStr(testCollocated, false) << "  ;"
                 << "  REPLICATED_ONLY=   " << BoolToStr(testReplicatedOnly, false) << ';'
                 << "ENFORCE_JOIN_ORDER=   " << BoolToStr(testEnforceJoinOrder, false) << "  ;"
@@ -348,6 +357,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringInvalidBoolKeys)
     keys.insert("enforce_join_order");
     keys.insert("replicated_only");
     keys.insert("collocated");
+    keys.insert("lazy");
 
     for (Set::const_iterator it = keys.begin(); it != keys.end(); ++it)
     {
@@ -374,6 +384,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringValidBoolKeys)
     keys.insert("enforce_join_order");
     keys.insert("replicated_only");
     keys.insert("collocated");
+    keys.insert("lazy");
 
     for (Set::const_iterator it = keys.begin(); it != keys.end(); ++it)
     {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
index e024275..b334141 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
@@ -79,6 +79,9 @@ namespace ignite
 
                     /** Connection attribute keyword for collocated attribute. */
                     static const std::string collocated;
+
+                    /** Connection attribute keyword for lazy attribute. */
+                    static const std::string lazy;
                 };
 
                 /** Default values for configuration. */
@@ -119,6 +122,9 @@ namespace ignite
 
                     /** Default value for collocated attribute. */
                     static const bool collocated;
+
+                    /** Default value for lazy attribute. */
+                    static const bool lazy;
                 };
 
                 /**
@@ -358,6 +364,26 @@ namespace ignite
                 }
 
                 /**
+                 * Check lazy flag.
+                 *
+                 * @return True if lazy is enabled.
+                 */
+                bool IsLazy() const
+                {
+                    return GetBoolValue(Key::lazy, DefaultValue::lazy);
+                }
+
+                /**
+                 * Set lazy.
+                 *
+                 * @param val Value to set.
+                 */
+                void SetLazy(bool val)
+                {
+                    SetBoolValue(Key::lazy, val);
+                }
+
+                /**
                  * Get protocol version.
                  *
                  * @return Protocol version.

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/include/ignite/odbc/message.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/message.h b/modules/platforms/cpp/odbc/include/ignite/odbc/message.h
index c6df0c9..836f2b6 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/message.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/message.h
@@ -88,9 +88,10 @@ namespace ignite
              * @param enforceJoinOrder Enforce join order flag.
              * @param replicatedOnly Replicated only flag.
              * @param collocated Collocated flag.
+             * @param lazy Lazy flag.
              */
             HandshakeRequest(const ProtocolVersion& version, bool distributedJoins, bool enforceJoinOrder,
-                bool replicatedOnly, bool collocated);
+                bool replicatedOnly, bool collocated, bool lazy);
 
             /**
              * Destructor.
@@ -118,6 +119,9 @@ namespace ignite
 
             /** Collocated flag. */
             bool collocated;
+
+            /** Lazy flag. */
+            bool lazy;
         };
 
         /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h b/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
index a3cb88e..c36d5dd 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
@@ -33,6 +33,7 @@ namespace ignite
         public:
             /** Current protocol version. */
             static const ProtocolVersion VERSION_2_1_0;
+            static const ProtocolVersion VERSION_2_1_5;
 
             typedef std::set<ProtocolVersion> VersionSet;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h b/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
index 87f5806..2974b67 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
@@ -54,6 +54,7 @@ namespace ignite
                             ENFORCE_JOIN_ORDER_CHECK_BOX,
                             REPLICATED_ONLY_CHECK_BOX,
                             COLLOCATED_CHECK_BOX,
+                            LAZY_CHECK_BOX,
                             PROTOCOL_VERSION_LABEL,
                             PROTOCOL_VERSION_COMBO_BOX,
                             OK_BUTTON,
@@ -145,6 +146,9 @@ namespace ignite
                     /** Collocated CheckBox. */
                     std::auto_ptr<Window> collocatedCheckBox;
 
+                    /** Lazy CheckBox. */
+                    std::auto_ptr<Window> lazyCheckBox;
+
                     /** Protocol version edit field. */
                     std::auto_ptr<Window> protocolVersionLabel;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
index c8bb9f8..9b13481 100644
--- a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
@@ -32,7 +32,7 @@ namespace ignite
                 DsnConfigurationWindow::DsnConfigurationWindow(Window* parent, config::Configuration& config):
                     CustomWindow(parent, "IgniteConfigureDsn", "Configure Apache Ignite DSN"),
                     width(360),
-                    height(280),
+                    height(300),
                     connectionSettingsGroupBox(),
                     nameLabel(),
                     nameEdit(),
@@ -142,13 +142,17 @@ namespace ignite
 
                     const ProtocolVersion::VersionSet& supported = ProtocolVersion::GetSupported();
 
+                    ProtocolVersion version = ProtocolVersion::GetCurrent();
                     ProtocolVersion::VersionSet::const_iterator it;
                     for (it = supported.begin(); it != supported.end(); ++it)
                     {
                         protocolVersionComboBox->AddString(it->ToString());
 
                         if (*it == config.GetProtocolVersion())
+                        {
                             protocolVersionComboBox->SetSelection(id);
+                            version = *it;
+                        }
 
                         ++id;
                     }
@@ -169,6 +173,13 @@ namespace ignite
                     collocatedCheckBox = CreateCheckBox(editPosX + checkBoxSize + interval, rowPos, checkBoxSize,
                         rowSize, "Collocated", ChildId::COLLOCATED_CHECK_BOX, config.IsCollocated());
 
+                    rowPos += rowSize;
+
+                    lazyCheckBox = CreateCheckBox(editPosX, rowPos, checkBoxSize, rowSize,
+                        "Lazy", ChildId::LAZY_CHECK_BOX, config.IsLazy());
+
+                    lazyCheckBox->SetEnabled(version >= ProtocolVersion::VERSION_2_1_5);
+
                     rowPos += interval * 2 + rowSize;
 
                     connectionSettingsGroupBox = CreateGroupBox(margin, sectionBegin, width - 2 * margin,
@@ -246,7 +257,24 @@ namespace ignite
                                     break;
                                 }
 
+                                case ChildId::LAZY_CHECK_BOX:
+                                {
+                                    lazyCheckBox->SetChecked(!lazyCheckBox->IsChecked());
+
+                                    break;
+                                }
+
                                 case ChildId::PROTOCOL_VERSION_COMBO_BOX:
+                                {
+                                    std::string versionStr;
+                                    protocolVersionComboBox->GetText(versionStr);
+
+                                    ProtocolVersion version = ProtocolVersion::FromString(versionStr);
+                                    lazyCheckBox->SetEnabled(version >= ProtocolVersion::VERSION_2_1_5);
+
+                                    break;
+                                }
+
                                 default:
                                     return false;
                             }
@@ -280,6 +308,7 @@ namespace ignite
                     bool enforceJoinOrder;
                     bool replicatedOnly;
                     bool collocated;
+                    bool lazy;
 
                     nameEdit->GetText(dsn);
                     addressEdit->GetText(address);
@@ -299,6 +328,7 @@ namespace ignite
                     enforceJoinOrder = enforceJoinOrderCheckBox->IsEnabled() && enforceJoinOrderCheckBox->IsChecked();
                     replicatedOnly = replicatedOnlyCheckBox->IsEnabled() && replicatedOnlyCheckBox->IsChecked();
                     collocated = collocatedCheckBox->IsEnabled() && collocatedCheckBox->IsChecked();
+                    lazy = lazyCheckBox->IsEnabled() && lazyCheckBox->IsChecked();
 
                     LOG_MSG("Retriving arguments:");
                     LOG_MSG("DSN:                " << dsn);
@@ -310,6 +340,7 @@ namespace ignite
                     LOG_MSG("Enforce Join Order: " << (enforceJoinOrder ? "true" : "false"));
                     LOG_MSG("Replicated only:    " << (replicatedOnly ? "true" : "false"));
                     LOG_MSG("Collocated:         " << (collocated ? "true" : "false"));
+                    LOG_MSG("Lazy:               " << (lazy ? "true" : "false"));
 
                     if (dsn.empty())
                         throw IgniteError(IgniteError::IGNITE_ERR_GENERIC, "DSN name can not be empty.");
@@ -323,6 +354,7 @@ namespace ignite
                     cfg.SetEnforceJoinOrder(enforceJoinOrder);
                     cfg.SetReplicatedOnly(replicatedOnly);
                     cfg.SetCollocated(collocated);
+                    cfg.SetLazy(lazy);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/src/config/configuration.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/configuration.cpp b/modules/platforms/cpp/odbc/src/config/configuration.cpp
index 1863197..95ed964 100644
--- a/modules/platforms/cpp/odbc/src/config/configuration.cpp
+++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp
@@ -44,6 +44,7 @@ namespace ignite
             const std::string Configuration::Key::pageSize          = "page_size";
             const std::string Configuration::Key::replicatedOnly    = "replicated_only";
             const std::string Configuration::Key::collocated        = "collocated";
+            const std::string Configuration::Key::lazy              = "lazy";
 
             const std::string Configuration::DefaultValue::dsn      = "Apache Ignite DSN";
             const std::string Configuration::DefaultValue::driver   = "Apache Ignite";
@@ -58,6 +59,7 @@ namespace ignite
             const bool Configuration::DefaultValue::enforceJoinOrder = false;
             const bool Configuration::DefaultValue::replicatedOnly   = false;
             const bool Configuration::DefaultValue::collocated       = false;
+            const bool Configuration::DefaultValue::lazy             = false;
 
             const ProtocolVersion& Configuration::DefaultValue::protocolVersion = ProtocolVersion::GetCurrent();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/src/connection.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/connection.cpp b/modules/platforms/cpp/odbc/src/connection.cpp
index d281f3b..80d1695 100644
--- a/modules/platforms/cpp/odbc/src/connection.cpp
+++ b/modules/platforms/cpp/odbc/src/connection.cpp
@@ -325,6 +325,7 @@ namespace ignite
             bool enforceJoinOrder = false;
             bool replicatedOnly = false;
             bool collocated = false;
+            bool lazy = false;
             ProtocolVersion protocolVersion;
 
             try
@@ -334,6 +335,7 @@ namespace ignite
                 enforceJoinOrder = config.IsEnforceJoinOrder();
                 replicatedOnly = config.IsReplicatedOnly();
                 collocated = config.IsCollocated();
+                lazy = config.IsLazy();
             }
             catch (const IgniteError& err)
             {
@@ -350,7 +352,7 @@ namespace ignite
                 return SqlResult::AI_ERROR;
             }
 
-            HandshakeRequest req(protocolVersion, distributedJoins, enforceJoinOrder, replicatedOnly, collocated);
+            HandshakeRequest req(protocolVersion, distributedJoins, enforceJoinOrder, replicatedOnly, collocated, lazy);
             HandshakeResponse rsp;
 
             try
@@ -373,7 +375,7 @@ namespace ignite
                 constructor << "Node rejected handshake message. ";
 
                 if (!rsp.GetError().empty())
-                    constructor << "Additional info: " << rsp.GetError();
+                    constructor << "Additional info: " << rsp.GetError() << " ";
 
                 constructor << "Current node Apache Ignite version: " << rsp.GetCurrentVer().ToString() << ", "
                             << "driver protocol version introduced in version: "

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/src/dsn_config.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/dsn_config.cpp b/modules/platforms/cpp/odbc/src/dsn_config.cpp
index 9d6e385..c91cd8c 100644
--- a/modules/platforms/cpp/odbc/src/dsn_config.cpp
+++ b/modules/platforms/cpp/odbc/src/dsn_config.cpp
@@ -106,6 +106,8 @@ namespace ignite
 
             bool collocated = ReadDsnBool(dsn, Configuration::Key::collocated, config.IsCollocated());
 
+            bool lazy = ReadDsnBool(dsn, Configuration::Key::lazy, config.IsLazy());
+
             std::string version = ReadDsnString(dsn, Configuration::Key::protocolVersion,
                 config.GetProtocolVersion().ToString().c_str());
 
@@ -122,6 +124,7 @@ namespace ignite
             config.SetEnforceJoinOrder(enforceJoinOrder);
             config.SetReplicatedOnly(replicatedOnly);
             config.SetCollocated(collocated);
+            config.SetLazy(lazy);
             config.SetProtocolVersion(version);
             config.SetPageSize(pageSize);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/src/message.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/message.cpp b/modules/platforms/cpp/odbc/src/message.cpp
index 79bf9c2..1bd0be5 100644
--- a/modules/platforms/cpp/odbc/src/message.cpp
+++ b/modules/platforms/cpp/odbc/src/message.cpp
@@ -23,12 +23,13 @@ namespace ignite
     namespace odbc
     {
         HandshakeRequest::HandshakeRequest(const ProtocolVersion& version, bool distributedJoins,
-            bool enforceJoinOrder, bool replicatedOnly, bool collocated):
+            bool enforceJoinOrder, bool replicatedOnly, bool collocated, bool lazy):
             version(version),
             distributedJoins(distributedJoins),
             enforceJoinOrder(enforceJoinOrder),
             replicatedOnly(replicatedOnly),
-            collocated(collocated)
+            collocated(collocated),
+            lazy(lazy)
         {
             // No-op.
         }
@@ -52,9 +53,11 @@ namespace ignite
             writer.WriteBool(enforceJoinOrder);
             writer.WriteBool(replicatedOnly);
             writer.WriteBool(collocated);
+            writer.WriteBool(lazy);
         }
 
-        QueryExecuteRequest::QueryExecuteRequest(const std::string& schema, const std::string& sql, const app::ParameterSet& params):
+        QueryExecuteRequest::QueryExecuteRequest(const std::string& schema, const std::string& sql,
+            const app::ParameterSet& params):
             schema(schema),
             sql(sql),
             params(params)
@@ -147,7 +150,8 @@ namespace ignite
             writer.WriteInt32(pageSize);
         }
 
-        QueryGetColumnsMetaRequest::QueryGetColumnsMetaRequest(const std::string& schema, const std::string& table, const std::string& column):
+        QueryGetColumnsMetaRequest::QueryGetColumnsMetaRequest(const std::string& schema, const std::string& table,
+            const std::string& column):
             schema(schema),
             table(table),
             column(column)
@@ -169,7 +173,8 @@ namespace ignite
             writer.WriteObject<std::string>(column);
         }
 
-        QueryGetTablesMetaRequest::QueryGetTablesMetaRequest(const std::string& catalog, const std::string& schema, const std::string& table, const std::string& tableTypes):
+        QueryGetTablesMetaRequest::QueryGetTablesMetaRequest(const std::string& catalog, const std::string& schema,
+            const std::string& table, const std::string& tableTypes):
             catalog(catalog),
             schema(schema),
             table(table),

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6cbc50f/modules/platforms/cpp/odbc/src/protocol_version.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/protocol_version.cpp b/modules/platforms/cpp/odbc/src/protocol_version.cpp
index aa8915d..b668fb8 100644
--- a/modules/platforms/cpp/odbc/src/protocol_version.cpp
+++ b/modules/platforms/cpp/odbc/src/protocol_version.cpp
@@ -26,10 +26,12 @@ namespace ignite
 {
     namespace odbc
     {
-        const ProtocolVersion ProtocolVersion::VERSION_2_1_0(ProtocolVersion(2,1,0));
+        const ProtocolVersion ProtocolVersion::VERSION_2_1_0(2, 1, 0);
+        const ProtocolVersion ProtocolVersion::VERSION_2_1_5(2, 1, 5);
 
         ProtocolVersion::VersionSet::value_type supportedArray[] = {
-            ProtocolVersion::VERSION_2_1_0
+            ProtocolVersion::VERSION_2_1_0,
+            ProtocolVersion::VERSION_2_1_5
         };
 
         const ProtocolVersion::VersionSet ProtocolVersion::supported(supportedArray,
@@ -58,7 +60,7 @@ namespace ignite
 
         const ProtocolVersion& ProtocolVersion::GetCurrent()
         {
-            return VERSION_2_1_0;
+            return VERSION_2_1_5;
         }
 
         void ThrowParseError()


[07/14] ignite git commit: ignite-3484

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


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

Branch: refs/heads/ignite-3484
Commit: e3bba83256c1eb53c4b40fbd9ddba47fcf9d58d5
Parents: 6be6779
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 6 10:10:26 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 6 10:10:26 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/tree/CacheDataTree.java    | 21 +++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e3bba832/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
index b65483e..99b1372 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
@@ -82,6 +82,10 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow> {
         initTree(initNew);
     }
 
+    /**
+     * @param grp Cache group.
+     * @return Tree inner IO.
+     */
     private static IOVersions<? extends AbstractDataInnerIO> innerIO(CacheGroupContext grp) {
         if (grp.mvccEnabled())
             return MvccDataInnerIO.VERSIONS;
@@ -89,6 +93,10 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow> {
         return grp.sharedGroup() ? CacheIdAwareDataInnerIO.VERSIONS : DataInnerIO.VERSIONS;
     }
 
+    /**
+     * @param grp Cache group.
+     * @return Tree leaf IO.
+     */
     private static IOVersions<? extends AbstractDataLeafIO> leafIO(CacheGroupContext grp) {
         if (grp.mvccEnabled())
             return MvccDataLeafIO.VERSIONS;
@@ -167,14 +175,21 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow> {
     /** {@inheritDoc} */
     @Override protected CacheDataRow getRow(BPlusIO<CacheSearchRow> io, long pageAddr, int idx, Object flags)
         throws IgniteCheckedException {
-        long link = ((RowLinkIO)io).getLink(pageAddr, idx);
-        int hash = ((RowLinkIO)io).getHash(pageAddr, idx);
-        int cacheId = ((RowLinkIO)io).getCacheId(pageAddr, idx);
+        RowLinkIO rowIo = (RowLinkIO)io;
+
+        long link = rowIo.getLink(pageAddr, idx);
+        int hash = rowIo.getHash(pageAddr, idx);
+        int cacheId = rowIo.getCacheId(pageAddr, idx);
 
         CacheDataRowAdapter.RowData x = flags != null ?
             (CacheDataRowAdapter.RowData)flags :
             CacheDataRowAdapter.RowData.FULL;
 
+//        if (grp.mvccEnabled()) {
+//            long mvccTopVer = rowIo.getMvccUpdateTopologyVersion(pageAddr, idx);
+//            long mvcCntr = rowIo.getMvccUpdateCounter(pageAddr, idx);
+//        }
+
         return rowStore.dataRow(cacheId, hash, link, x);
     }
 


[04/14] ignite git commit: ignite-6273 Moved ServiceDeploymentException to org.apache.ignite.services

Posted by sb...@apache.org.
ignite-6273 Moved ServiceDeploymentException to org.apache.ignite.services


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

Branch: refs/heads/ignite-3484
Commit: d7e215d67cc059363a0149629c53fb3d7343d28f
Parents: 8f13169
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 5 17:03:57 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 5 17:03:57 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteServices.java  |  2 +-
 .../GridServiceDeploymentCompoundFuture.java    |  1 +
 .../service/GridServiceProcessor.java           |  1 +
 .../service/ServiceDeploymentException.java     | 78 --------------------
 .../services/ServiceDeploymentException.java    | 77 +++++++++++++++++++
 ...ServiceDeploymentCompoundFutureSelfTest.java |  1 +
 ...GridServiceProcessorBatchDeploySelfTest.java |  1 +
 7 files changed, 82 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d7e215d6/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteServices.java b/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
index 271adbb..e161b11 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
@@ -20,7 +20,7 @@ package org.apache.ignite;
 import java.util.Collection;
 import org.apache.ignite.cluster.ClusterGroup;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.service.ServiceDeploymentException;
+import org.apache.ignite.services.ServiceDeploymentException;
 import org.apache.ignite.lang.IgniteAsyncSupport;
 import org.apache.ignite.lang.IgniteAsyncSupported;
 import org.apache.ignite.lang.IgniteFuture;

http://git-wip-us.apache.org/repos/asf/ignite/blob/d7e215d6/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
index 12b88e5..bbf0370 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.services.ServiceDeploymentException;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/d7e215d6/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 3adad23..2b3a882 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -98,6 +98,7 @@ import org.apache.ignite.resources.JobContextResource;
 import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.services.Service;
 import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.services.ServiceDeploymentException;
 import org.apache.ignite.services.ServiceDescriptor;
 import org.apache.ignite.thread.IgniteThreadFactory;
 import org.apache.ignite.transactions.Transaction;

http://git-wip-us.apache.org/repos/asf/ignite/blob/d7e215d6/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceDeploymentException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceDeploymentException.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceDeploymentException.java
deleted file mode 100644
index 32fbf6f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceDeploymentException.java
+++ /dev/null
@@ -1,78 +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.service;
-
-import java.util.Collection;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.services.ServiceConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating service deployment failure.
- */
-public class ServiceDeploymentException extends IgniteException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private final Collection<ServiceConfiguration> cfgs;
-
-    /**
-     * Creates service deployment exception with error message.
-     *
-     * @param msg Error message.
-     * @param cfgs Configurations of services that failed to deploy.
-     */
-    public ServiceDeploymentException(String msg, Collection<ServiceConfiguration> cfgs) {
-        super(msg);
-
-        this.cfgs = cfgs;
-    }
-
-    /**
-     * Creates service deployment exception with {@link Throwable} as a cause.
-     *
-     * @param cause Cause.
-     * @param cfgs Configurations of services that failed to deploy.
-     */
-    public ServiceDeploymentException(Throwable cause, Collection<ServiceConfiguration> cfgs) {
-        super(cause);
-
-        this.cfgs = cfgs;
-    }
-
-    /**
-     * Creates service deployment exception with error message and {@link Throwable} as a cause.
-     *
-     * @param msg Error message.
-     * @param cause Cause.
-     * @param cfgs Configurations of services that failed to deploy.
-     */
-    public ServiceDeploymentException(String msg, @Nullable Throwable cause, Collection<ServiceConfiguration> cfgs) {
-        super(msg, cause);
-
-        this.cfgs = cfgs;
-    }
-
-    /**
-     * @return Configurations of services that failed to deploy.
-     */
-    public Collection<ServiceConfiguration> getFailedConfigurations() {
-        return cfgs;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d7e215d6/modules/core/src/main/java/org/apache/ignite/services/ServiceDeploymentException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/services/ServiceDeploymentException.java b/modules/core/src/main/java/org/apache/ignite/services/ServiceDeploymentException.java
new file mode 100644
index 0000000..843a8fe
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/services/ServiceDeploymentException.java
@@ -0,0 +1,77 @@
+/*
+ * 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.services;
+
+import java.util.Collection;
+import org.apache.ignite.IgniteException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Exception indicating service deployment failure.
+ */
+public class ServiceDeploymentException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private final Collection<ServiceConfiguration> cfgs;
+
+    /**
+     * Creates service deployment exception with error message.
+     *
+     * @param msg Error message.
+     * @param cfgs Configurations of services that failed to deploy.
+     */
+    public ServiceDeploymentException(String msg, Collection<ServiceConfiguration> cfgs) {
+        super(msg);
+
+        this.cfgs = cfgs;
+    }
+
+    /**
+     * Creates service deployment exception with {@link Throwable} as a cause.
+     *
+     * @param cause Cause.
+     * @param cfgs Configurations of services that failed to deploy.
+     */
+    public ServiceDeploymentException(Throwable cause, Collection<ServiceConfiguration> cfgs) {
+        super(cause);
+
+        this.cfgs = cfgs;
+    }
+
+    /**
+     * Creates service deployment exception with error message and {@link Throwable} as a cause.
+     *
+     * @param msg Error message.
+     * @param cause Cause.
+     * @param cfgs Configurations of services that failed to deploy.
+     */
+    public ServiceDeploymentException(String msg, @Nullable Throwable cause, Collection<ServiceConfiguration> cfgs) {
+        super(msg, cause);
+
+        this.cfgs = cfgs;
+    }
+
+    /**
+     * @return Configurations of services that failed to deploy.
+     */
+    public Collection<ServiceConfiguration> getFailedConfigurations() {
+        return cfgs;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d7e215d6/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
index 51c3407..ca95198 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.services.ServiceDeploymentException;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/d7e215d6/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
index 4916aff..dc19f33 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.internal.IgniteNodeAttributes;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.services.ServiceDeploymentException;
 import org.apache.ignite.services.ServiceDescriptor;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;


[12/14] 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/distributed/dht/GridDhtTxPrepareFuture.java


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

Branch: refs/heads/ignite-3484
Commit: dcaf8801accd6ee089849a82b2ccd558aec81895
Parents: 27b87b4
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 6 11:19:30 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 6 11:19:30 2017 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtTxPrepareFuture.java  | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dcaf8801/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 5ac86da..3bb4ea8 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
@@ -1263,19 +1263,8 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             if (isDone())
                 return;
 
-            if (last)
-                sendPrepareRequests();
-        }
-        finally {
-            markInitialized();
-        }
-    }
-
-    /**
-     *
-     */
-    private void sendPrepareRequests() {
-        if (waitCrdCntrFut != null) {
+            if (last) {
+                if (waitCrdCntrFut != null) {
                     skipInit = true;
 
                     waitCrdCntrFut.listen(new IgniteInClosure<IgniteInternalFuture<Long>>() {
@@ -1322,7 +1311,9 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             }
         }
 
-                assert !tx.txState().mvccEnabled(cctx) || !tx.onePhaseCommit() || tx.mvccCoordinatorCounter() != TxMvccVersion.COUNTER_NA;int miniId = 0;
+        assert !tx.txState().mvccEnabled(cctx) || !tx.onePhaseCommit() || tx.mvccCoordinatorCounter() != TxMvccVersion.COUNTER_NA;
+
+        int miniId = 0;
 
         assert tx.transactionNodes() != null;