You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2019/12/20 09:09:17 UTC

[ignite] branch master updated: IGNITE-11705: Ability to control affinity cache size. added.

This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b638a5  IGNITE-11705: Ability to control affinity cache size. added.
7b638a5 is described below

commit 7b638a512792d9c6ed579cea060a45e745d8c296
Author: alapin <la...@gmail.com>
AuthorDate: Wed Jun 5 16:48:13 2019 +0300

    IGNITE-11705: Ability to control affinity cache size. added.
---
 .../thin/JdbcThinAffinityAwarenessSelfTest.java    |  93 +++++--
 .../jdbc/thin/JdbcThinConnectionSelfTest.java      | 288 ++++++++++++++-------
 .../ignite/jdbc/thin/JdbcThinMetadataSelfTest.java |  17 +-
 .../ignite/internal/jdbc/thin/AffinityCache.java   |  21 +-
 .../internal/jdbc/thin/ConnectionProperties.java   |  27 ++
 .../jdbc/thin/ConnectionPropertiesImpl.java        |  40 ++-
 .../JdbcThinAffinityAwarenessMappingGroup.java     |  10 +-
 .../internal/jdbc/thin/JdbcThinConnection.java     |  66 +++--
 8 files changed, 401 insertions(+), 161 deletions(-)

diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAffinityAwarenessSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAffinityAwarenessSelfTest.java
index f0e632c..1383c5a 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAffinityAwarenessSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAffinityAwarenessSelfTest.java
@@ -42,6 +42,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.jdbc.thin.AffinityCache;
 import org.apache.ignite.internal.jdbc.thin.JdbcThinPartitionResultDescriptor;
 import org.apache.ignite.internal.jdbc.thin.QualifiedSQLQuery;
+import org.apache.ignite.internal.processors.cache.GridCacheUtils;
 import org.apache.ignite.internal.processors.query.QueryHistory;
 import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.sql.optimizer.affinity.PartitionResult;
@@ -433,22 +434,22 @@ public class JdbcThinAffinityAwarenessSelfTest extends JdbcThinAbstractSelfTest
      */
     @Test
     public void testAffinityAwarenessIsSkippedIfItIsSwitchedOff() throws Exception {
-        Connection conn = DriverManager.getConnection(
+        try (Connection conn = DriverManager.getConnection(
             "jdbc:ignite:thin://127.0.0.1:10800..10802?affinityAwareness=false");
+             Statement stmt = conn.createStatement()) {
 
-        Statement stmt = conn.createStatement();
+            final String cacheName = "yac";
 
-        final String cacheName = "yac";
+            CacheConfiguration<Object, Object> cache = prepareCacheConfig(cacheName);
 
-        CacheConfiguration<Object, Object> cache = prepareCacheConfig(cacheName);
+            ignite(0).createCache(cache);
 
-        ignite(0).createCache(cache);
+            stmt.executeQuery("select * from \"" + cacheName + "\".Person where _key = 1");
 
-        stmt.executeQuery("select * from \"" + cacheName + "\".Person where _key = 1");
+            AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache");
 
-        AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache");
-
-        assertNull("Affinity cache is not null.", affinityCache);
+            assertNull("Affinity cache is not null.", affinityCache);
+        }
     }
 
     /**
@@ -458,22 +459,22 @@ public class JdbcThinAffinityAwarenessSelfTest extends JdbcThinAbstractSelfTest
      */
     @Test
     public void testAffinityAwarenessIsSkippedByDefault() throws Exception {
-        Connection conn = DriverManager.getConnection(
+        try (Connection conn = DriverManager.getConnection(
             "jdbc:ignite:thin://127.0.0.1:10800..10802");
+             Statement stmt = conn.createStatement()) {
 
-        Statement stmt = conn.createStatement();
+            final String cacheName = "yacccc";
 
-        final String cacheName = "yacccc";
+            CacheConfiguration<Object, Object> cache = prepareCacheConfig(cacheName);
 
-        CacheConfiguration<Object, Object> cache = prepareCacheConfig(cacheName);
-
-        ignite(0).createCache(cache);
+            ignite(0).createCache(cache);
 
-        stmt.executeQuery("select * from \"" + cacheName + "\".Person where _key = 1");
+            stmt.executeQuery("select * from \"" + cacheName + "\".Person where _key = 1");
 
-        AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache");
+            AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache");
 
-        assertNull("Affinity cache is not null.", affinityCache);
+            assertNull("Affinity cache is not null.", affinityCache);
+        }
     }
 
     /**
@@ -555,6 +556,62 @@ public class JdbcThinAffinityAwarenessSelfTest extends JdbcThinAbstractSelfTest
     }
 
     /**
+     * Check that affinityAwarenessSQLCacheSize and affinityAwarenessPartitionDistributionsCacheSize
+     * actually limit corresponding caches within affinity awareness cache.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testAffinityAwarenessLimitedCacheSize() throws Exception {
+        try (Connection conn = DriverManager.getConnection(
+            "jdbc:ignite:thin://127.0.0.1:10800..10802?affinityAwareness=true" +
+                "&affinityAwarenessSQLCacheSize=1&affinityAwarenessPartitionDistributionsCacheSize=1");
+             Statement stmt = conn.createStatement()) {
+            final String cacheName1 = UUID.randomUUID().toString().substring(0, 6);
+
+            CacheConfiguration<Object, Object> cache1 = prepareCacheConfig(cacheName1);
+
+            ignite(0).createCache(cache1);
+
+            fillCache(cacheName1);
+
+            final String cacheName2 = UUID.randomUUID().toString().substring(0, 6);
+
+            CacheConfiguration<Object, Object> cache2 = prepareCacheConfig(cacheName2);
+
+            ignite(0).createCache(cache2);
+
+            fillCache(cacheName2);
+
+            stmt.executeQuery("select * from \"" + cacheName1 + "\".Person where _key = 1");
+            stmt.executeQuery("select * from \"" + cacheName1 + "\".Person where _key = 1");
+
+            stmt.executeQuery("select * from \"" + cacheName2 + "\".Person where _key = 1");
+            stmt.executeQuery("select * from \"" + cacheName2 + "\".Person where _key = 1");
+
+            AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache");
+
+            GridBoundedLinkedHashMap<Integer, UUID[]> partitionsDistributionCache =
+                GridTestUtils.getFieldValue(affinityCache, "cachePartitionsDistribution");
+
+            GridBoundedLinkedHashMap<QualifiedSQLQuery, JdbcThinPartitionResultDescriptor> sqlCache =
+                GridTestUtils.getFieldValue(affinityCache, "sqlCache");
+
+            assertEquals("Unexpected count of partitions distributions.", 1,
+                partitionsDistributionCache.size());
+
+            assertEquals("Unexpected count of sql queries.", 1, sqlCache.size());
+
+            assertTrue("Unexpected distribution is found.",
+                partitionsDistributionCache.containsKey(GridCacheUtils.cacheId(cacheName2)));
+
+            assertTrue("Unexpected sql query is found.",
+                sqlCache.containsKey(new QualifiedSQLQuery("PUBLIC",
+                    "select * from \"" + cacheName2 + "\".Person where _key = 1")));
+        }
+    }
+
+    /**
      * Prepares default cache configuration with given name.
      *
      * @param cacheName Cache name.
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
index 185fa91..f29ccfa 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
@@ -93,11 +93,11 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
         "jdbc:ignite:thin://127.0.0.1:10800..10802" :
         "jdbc:ignite:thin://127.0.0.1";
 
-    /** URL with affinity awareness flag. */
-    private String urlWithAffinityAwarenessFlag = url + "?affinityAwareness=" + affinityAwareness;
+    /** URL with affinity awareness property. */
+    private String urlWithAffinityAwarenessProp = url + "?affinityAwareness=" + affinityAwareness;
 
-    /** URL with affinity awareness flag and semicolon as delimeter. */
-    private String urlWithAffinityAwarenessFlagSemicolon = url + ";affinityAwareness=" + affinityAwareness;
+    /** URL with affinity awareness property and semicolon as delimiter. */
+    private String urlWithAffinityAwarenessPropSemicolon = url + ";affinityAwareness=" + affinityAwareness;
 
     /** Nodes count. */
     private int nodesCnt = affinityAwareness ? 4 : 2;
@@ -175,13 +175,13 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
     public void testSocketBuffers() throws Exception {
         final int dfltDufSize = 64 * 1024;
 
-        assertInvalid(urlWithAffinityAwarenessFlag + "&socketSendBuffer=-1",
+        assertInvalid(urlWithAffinityAwarenessProp + "&socketSendBuffer=-1",
             "Property cannot be lower than 0 [name=socketSendBuffer, value=-1]");
 
-        assertInvalid(urlWithAffinityAwarenessFlag + "&socketReceiveBuffer=-1",
+        assertInvalid(urlWithAffinityAwarenessProp + "&socketReceiveBuffer=-1",
             "Property cannot be lower than 0 [name=socketReceiveBuffer, value=-1]");
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             for (JdbcThinTcpIo io: ios(conn)) {
                 assertEquals(dfltDufSize, io.connectionProperties().getSocketSendBuffer());
                 assertEquals(dfltDufSize, io.connectionProperties().getSocketReceiveBuffer());
@@ -189,21 +189,21 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
         }
 
         // Note that SO_* options are hints, so we check that value is equals to either what we set or to default.
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&socketSendBuffer=1024")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&socketSendBuffer=1024")) {
             for (JdbcThinTcpIo io: ios(conn)) {
                 assertEquals(1024, io.connectionProperties().getSocketSendBuffer());
                 assertEquals(dfltDufSize, io.connectionProperties().getSocketReceiveBuffer());
             }
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&socketReceiveBuffer=1024")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&socketReceiveBuffer=1024")) {
             for (JdbcThinTcpIo io: ios(conn)) {
                 assertEquals(dfltDufSize, io.connectionProperties().getSocketSendBuffer());
                 assertEquals(1024, io.connectionProperties().getSocketReceiveBuffer());
             }
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&" +
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&" +
             "socketSendBuffer=1024&socketReceiveBuffer=2048")) {
             for (JdbcThinTcpIo io: ios(conn)) {
                 assertEquals(1024, io.connectionProperties().getSocketSendBuffer());
@@ -221,28 +221,28 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
     public void testSocketBuffersSemicolon() throws Exception {
         final int dfltDufSize = 64 * 1024;
 
-        assertInvalid(urlWithAffinityAwarenessFlagSemicolon + ";socketSendBuffer=-1",
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";socketSendBuffer=-1",
             "Property cannot be lower than 0 [name=socketSendBuffer, value=-1]");
 
-        assertInvalid(urlWithAffinityAwarenessFlagSemicolon + ";socketReceiveBuffer=-1",
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";socketReceiveBuffer=-1",
             "Property cannot be lower than 0 [name=socketReceiveBuffer, value=-1]");
 
         // Note that SO_* options are hints, so we check that value is equals to either what we set or to default.
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";socketSendBuffer=1024")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";socketSendBuffer=1024")) {
             for (JdbcThinTcpIo io: ios(conn)) {
                 assertEquals(1024, io.connectionProperties().getSocketSendBuffer());
                 assertEquals(dfltDufSize, io.connectionProperties().getSocketReceiveBuffer());
             }
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";socketReceiveBuffer=1024")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";socketReceiveBuffer=1024")) {
             for (JdbcThinTcpIo io: ios(conn)) {
                 assertEquals(dfltDufSize, io.connectionProperties().getSocketSendBuffer());
                 assertEquals(1024, io.connectionProperties().getSocketReceiveBuffer());
             }
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";" +
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";" +
             "socketSendBuffer=1024;socketReceiveBuffer=2048")) {
             for (JdbcThinTcpIo io: ios(conn)) {
                 assertEquals(1024, io.connectionProperties().getSocketSendBuffer());
@@ -258,21 +258,21 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testUpdateBatchSize() throws Exception {
-        assertInvalid(urlWithAffinityAwarenessFlagSemicolon + ";updateBatchSize=-1",
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";updateBatchSize=-1",
             "Property cannot be lower than 1 [name=updateBatchSize, value=-1]");
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon)) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertNull(io.connectionProperties().getUpdateBatchSize());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon
             + ";updateBatchSize=1024")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertEquals(1024, (int)io.connectionProperties().getUpdateBatchSize());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag +
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp +
             "&updateBatchSize=1024")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertEquals(1024, (int)io.connectionProperties().getUpdateBatchSize());
@@ -280,48 +280,140 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
     }
 
     /**
+     * Test affinity awareness Sql cache size property.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testAffinityAwarenessSqlCacheSizeProperty() throws Exception {
+        assertInvalid(urlWithAffinityAwarenessProp + "&affinityAwarenessSQLCacheSize=0",
+            "Property cannot be lower than 1 [name=affinityAwarenessSQLCacheSize, value=0]");
+
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
+            for (JdbcThinTcpIo io : ios(conn))
+                assertEquals(1_000, io.connectionProperties().getAffinityAwarenessSqlCacheSize());
+        }
+
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp +
+            "&affinityAwarenessSQLCacheSize=100")) {
+            for (JdbcThinTcpIo io : ios(conn))
+                assertEquals(100, io.connectionProperties().getAffinityAwarenessSqlCacheSize());
+        }
+    }
+
+    /**
+     * Test affinity awareness Sql cache size property with semicolon.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testAffinityAwarenessSqlCacheSizePropertySemicolon() throws Exception {
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";affinityAwarenessSQLCacheSize=0",
+            "Property cannot be lower than 1 [name=affinityAwarenessSQLCacheSize, value=0]");
+
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon)) {
+            for (JdbcThinTcpIo io : ios(conn))
+                assertEquals(1_000, io.connectionProperties().getAffinityAwarenessSqlCacheSize());
+        }
+
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon +
+            ";affinityAwarenessSQLCacheSize=100")) {
+            for (JdbcThinTcpIo io : ios(conn))
+                assertEquals(100, io.connectionProperties().getAffinityAwarenessSqlCacheSize());
+        }
+    }
+
+    /**
+     * Test affinity awareness partition distributions cache size property.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testAffinityAwarenessPartitionDistributionsCacheSizeProperty() throws Exception {
+        assertInvalid(urlWithAffinityAwarenessProp + "&affinityAwarenessPartitionDistributionsCacheSize=0",
+            "Property cannot be lower than 1 [name=affinityAwarenessPartitionDistributionsCacheSize, value=0]");
+
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
+            for (JdbcThinTcpIo io : ios(conn)) {
+                assertEquals(1_000,
+                    io.connectionProperties().getAffinityAwarenessPartitionDistributionsCacheSize());
+            }
+        }
+
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp +
+            "&affinityAwarenessPartitionDistributionsCacheSize=100")) {
+            for (JdbcThinTcpIo io : ios(conn))
+                assertEquals(100, io.connectionProperties().getAffinityAwarenessPartitionDistributionsCacheSize());
+        }
+    }
+
+    /**
+     * Test affinity awareness partition distributions cache size property with semicolon.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testAffinityAwarenessPartitionDistributionsCacheSizePropertySemicolon() throws Exception {
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";affinityAwarenessPartitionDistributionsCacheSize=0",
+            "Property cannot be lower than 1 [name=affinityAwarenessPartitionDistributionsCacheSize, value=0]");
+
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon)) {
+            for (JdbcThinTcpIo io : ios(conn)) {
+                assertEquals(1_000,
+                    io.connectionProperties().getAffinityAwarenessPartitionDistributionsCacheSize());
+            }
+        }
+
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon +
+            ";affinityAwarenessPartitionDistributionsCacheSize=100")) {
+            for (JdbcThinTcpIo io : ios(conn))
+                assertEquals(100, io.connectionProperties().getAffinityAwarenessPartitionDistributionsCacheSize());
+        }
+    }
+
+    /**
      * Test SQL hints.
      *
      * @throws Exception If failed.
      */
     @Test
     public void testSqlHints() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             assertHints(conn, false, false, false, false, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&distributedJoins=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&distributedJoins=true")) {
             assertHints(conn, true, false, false, false, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&enforceJoinOrder=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&enforceJoinOrder=true")) {
             assertHints(conn, false, true, false, false, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&collocated=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&collocated=true")) {
             assertHints(conn, false, false, true, false, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&replicatedOnly=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&replicatedOnly=true")) {
             assertHints(conn, false, false, false, true, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&lazy=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&lazy=true")) {
             assertHints(conn, false, false, false, false, true,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&skipReducerOnUpdate=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&skipReducerOnUpdate=true")) {
             assertHints(conn, false, false, false, false, false,
                 true, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&distributedJoins=true&" +
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&distributedJoins=true&" +
             "enforceJoinOrder=true&collocated=true&replicatedOnly=true&lazy=true&skipReducerOnUpdate=true")) {
             assertHints(conn, true, true, true, true, true,
                 true, affinityAwareness);
@@ -335,37 +427,37 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testSqlHintsSemicolon() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";distributedJoins=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";distributedJoins=true")) {
             assertHints(conn, true, false, false, false, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";enforceJoinOrder=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";enforceJoinOrder=true")) {
             assertHints(conn, false, true, false, false, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";collocated=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";collocated=true")) {
             assertHints(conn, false, false, true, false, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";replicatedOnly=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";replicatedOnly=true")) {
             assertHints(conn, false, false, false, true, false,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";lazy=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";lazy=true")) {
             assertHints(conn, false, false, false, false, true,
                 false, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";skipReducerOnUpdate=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";skipReducerOnUpdate=true")) {
             assertHints(conn, false, false, false, false, false,
                 true, affinityAwareness);
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";distributedJoins=true;" +
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";distributedJoins=true;" +
             "enforceJoinOrder=true;collocated=true;replicatedOnly=true;lazy=true;skipReducerOnUpdate=true")) {
             assertHints(conn, true, true, true, true, true,
                 true, affinityAwareness);
@@ -404,39 +496,39 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testTcpNoDelay() throws Exception {
-        assertInvalid(urlWithAffinityAwarenessFlag + "&tcpNoDelay=0",
+        assertInvalid(urlWithAffinityAwarenessProp + "&tcpNoDelay=0",
             "Invalid property value. [name=tcpNoDelay, val=0, choices=[true, false]]");
 
-        assertInvalid(urlWithAffinityAwarenessFlag + "&tcpNoDelay=1",
+        assertInvalid(urlWithAffinityAwarenessProp + "&tcpNoDelay=1",
             "Invalid property value. [name=tcpNoDelay, val=1, choices=[true, false]]");
 
-        assertInvalid(urlWithAffinityAwarenessFlag + "&tcpNoDelay=false1",
+        assertInvalid(urlWithAffinityAwarenessProp + "&tcpNoDelay=false1",
             "Invalid property value. [name=tcpNoDelay, val=false1, choices=[true, false]]");
 
-        assertInvalid(urlWithAffinityAwarenessFlag + "&tcpNoDelay=true1",
+        assertInvalid(urlWithAffinityAwarenessProp + "&tcpNoDelay=true1",
             "Invalid property value. [name=tcpNoDelay, val=true1, choices=[true, false]]");
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertTrue(io.connectionProperties().isTcpNoDelay());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&tcpNoDelay=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&tcpNoDelay=true")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertTrue(io.connectionProperties().isTcpNoDelay());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&tcpNoDelay=True")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&tcpNoDelay=True")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertTrue(io.connectionProperties().isTcpNoDelay());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&tcpNoDelay=false")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&tcpNoDelay=false")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertFalse(io.connectionProperties().isTcpNoDelay());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&tcpNoDelay=False")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp + "&tcpNoDelay=False")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertFalse(io.connectionProperties().isTcpNoDelay());
         }
@@ -449,34 +541,34 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testTcpNoDelaySemicolon() throws Exception {
-        assertInvalid(urlWithAffinityAwarenessFlagSemicolon + ";tcpNoDelay=0",
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";tcpNoDelay=0",
             "Invalid property value. [name=tcpNoDelay, val=0, choices=[true, false]]");
 
-        assertInvalid(urlWithAffinityAwarenessFlagSemicolon + ";tcpNoDelay=1",
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";tcpNoDelay=1",
             "Invalid property value. [name=tcpNoDelay, val=1, choices=[true, false]]");
 
-        assertInvalid(urlWithAffinityAwarenessFlagSemicolon + ";tcpNoDelay=false1",
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";tcpNoDelay=false1",
             "Invalid property value. [name=tcpNoDelay, val=false1, choices=[true, false]]");
 
-        assertInvalid(urlWithAffinityAwarenessFlagSemicolon + ";tcpNoDelay=true1",
+        assertInvalid(urlWithAffinityAwarenessPropSemicolon + ";tcpNoDelay=true1",
             "Invalid property value. [name=tcpNoDelay, val=true1, choices=[true, false]]");
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";tcpNoDelay=true")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";tcpNoDelay=true")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertTrue(io.connectionProperties().isTcpNoDelay());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";tcpNoDelay=True")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";tcpNoDelay=True")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertTrue(io.connectionProperties().isTcpNoDelay());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";tcpNoDelay=false")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";tcpNoDelay=false")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertFalse(io.connectionProperties().isTcpNoDelay());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";tcpNoDelay=False")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";tcpNoDelay=False")) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertFalse(io.connectionProperties().isTcpNoDelay());
         }
@@ -489,7 +581,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testAutoCloseServerCursorProperty() throws Exception {
-        String url = urlWithAffinityAwarenessFlag + "&autoCloseServerCursor";
+        String url = urlWithAffinityAwarenessProp + "&autoCloseServerCursor";
 
         String err = "Invalid property value. [name=autoCloseServerCursor";
 
@@ -498,7 +590,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
         assertInvalid(url + "=false1", err);
         assertInvalid(url + "=true1", err);
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             for (JdbcThinTcpIo io: ios(conn))
                 assertFalse(io.connectionProperties().isAutoCloseServerCursor());
         }
@@ -531,7 +623,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testAutoCloseServerCursorPropertySemicolon() throws Exception {
-        String url = urlWithAffinityAwarenessFlagSemicolon + ";autoCloseServerCursor";
+        String url = urlWithAffinityAwarenessPropSemicolon + ";autoCloseServerCursor";
 
         String err = "Invalid property value. [name=autoCloseServerCursor";
 
@@ -591,15 +683,15 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testSchemaSemicolon() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";schema=public")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";schema=public")) {
             assertEquals("Invalid schema", "PUBLIC", conn.getSchema());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";schema=\"" + DEFAULT_CACHE_NAME + '"')) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";schema=\"" + DEFAULT_CACHE_NAME + '"')) {
             assertEquals("Invalid schema", DEFAULT_CACHE_NAME, conn.getSchema());
         }
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlagSemicolon + ";schema=_not_exist_schema_")) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessPropSemicolon + ";schema=_not_exist_schema_")) {
             assertEquals("Invalid schema", "_NOT_EXIST_SCHEMA_", conn.getSchema());
         }
     }
@@ -648,7 +740,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
     public void testClose() throws Exception {
         final Connection conn;
 
-        try (Connection conn0 = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn0 = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             conn = conn0;
 
             assert conn != null;
@@ -673,7 +765,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateStatement() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             try (Statement stmt = conn.createStatement()) {
                 assertNotNull(stmt);
 
@@ -696,7 +788,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateStatement2() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             int [] rsTypes = new int[]
                 {TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE};
 
@@ -750,7 +842,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateStatement3() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             int [] rsTypes = new int[]
                 {TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE};
 
@@ -810,7 +902,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testPrepareStatement() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // null query text
             assertThrows(log,
                 new Callable<Object>() {
@@ -844,7 +936,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testPrepareStatement3() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             final String sqlText = "select * from test where param = ?";
 
             int [] rsTypes = new int[]
@@ -905,7 +997,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testPrepareStatement4() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             final String sqlText = "select * from test where param = ?";
 
             int [] rsTypes = new int[]
@@ -971,7 +1063,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testPrepareStatementAutoGeneratedKeysUnsupported() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             final String sqlText = "insert into test (val) values (?)";
 
             assertThrows(log,
@@ -1021,7 +1113,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testPrepareCallUnsupported() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             final String sqlText = "exec test()";
 
             assertThrows(log,
@@ -1062,7 +1154,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testNativeSql() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // null query text
             assertThrows(log,
                 new Callable<Object>() {
@@ -1094,7 +1186,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetAutoCommit() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             boolean ac0 = conn.getAutoCommit();
 
             conn.setAutoCommit(!ac0);
@@ -1119,7 +1211,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCommit() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // Should not be called in auto-commit mode
             assertThrows(log,
                 new Callable<Object>() {
@@ -1164,7 +1256,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testRollback() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // Should not be called in auto-commit mode
             assertThrows(log,
                 new Callable<Object>() {
@@ -1194,7 +1286,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testBeginFailsWhenMvccIsDisabled() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             conn.createStatement().execute("BEGIN");
 
             fail("Exception is expected");
@@ -1209,7 +1301,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCommitIgnoredWhenMvccIsDisabled() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             conn.setAutoCommit(false);
             conn.createStatement().execute("COMMIT");
 
@@ -1223,7 +1315,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testRollbackIgnoredWhenMvccIsDisabled() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             conn.setAutoCommit(false);
 
             conn.createStatement().execute("ROLLBACK");
@@ -1238,7 +1330,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetMetaData() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             DatabaseMetaData meta = conn.getMetaData();
 
             assertNotNull(meta);
@@ -1259,7 +1351,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetReadOnly() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             conn.close();
 
             // Exception when called on closed connection
@@ -1283,7 +1375,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetCatalog() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             assert !conn.getMetaData().supportsCatalogsInDataManipulation();
 
             assertNull(conn.getCatalog());
@@ -1315,7 +1407,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetTransactionIsolation() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // Invalid parameter value
             assertThrows(log,
                 new Callable<Object>() {
@@ -1366,7 +1458,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testClearGetWarnings() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             SQLWarning warn = conn.getWarnings();
 
             assertNull(warn);
@@ -1400,7 +1492,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetTypeMap() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             assertThrows(log,
                 new Callable<Object>() {
                     @Override public Object call() throws Exception {
@@ -1456,7 +1548,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetHoldability() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // default value
             assertEquals(conn.getMetaData().getResultSetHoldability(), conn.getHoldability());
 
@@ -1510,7 +1602,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testSetSavepoint() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             assert !conn.getMetaData().supportsSavepoints();
 
             // Disallowed in auto-commit mode
@@ -1541,7 +1633,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testSetSavepointName() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             assert !conn.getMetaData().supportsSavepoints();
 
             // Invalid arg
@@ -1587,7 +1679,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testRollbackSavePoint() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             assert !conn.getMetaData().supportsSavepoints();
 
             // Invalid arg
@@ -1633,7 +1725,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testReleaseSavepoint() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             assert !conn.getMetaData().supportsSavepoints();
 
             // Invalid arg
@@ -1672,7 +1764,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateClob() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // Unsupported
             assertThrows(log,
                 new Callable<Object>() {
@@ -1703,7 +1795,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateBlob() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // Unsupported
             assertThrows(log,
                 new Callable<Object>() {
@@ -1734,7 +1826,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateNClob() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // Unsupported
             assertThrows(log,
                 new Callable<Object>() {
@@ -1765,7 +1857,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateSQLXML() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // Unsupported
             assertThrows(log,
                 new Callable<Object>() {
@@ -1798,7 +1890,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
     public void testGetSetClientInfoPair() throws Exception {
 //        fail("https://issues.apache.org/jira/browse/IGNITE-5425");
 
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             final String name = "ApplicationName";
             final String val = "SelfTest";
 
@@ -1832,7 +1924,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetClientInfoProperties() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             final String name = "ApplicationName";
             final String val = "SelfTest";
 
@@ -1871,7 +1963,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateArrayOf() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             final String typeName = "varchar";
 
             final String[] elements = new String[] {"apple", "pear"};
@@ -1912,7 +2004,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testCreateStruct() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // Invalid typename
             assertThrows(log,
                 new Callable<Object>() {
@@ -1949,7 +2041,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetSchema() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             assertEquals("PUBLIC", conn.getSchema());
 
             final String schema = "test";
@@ -1983,7 +2075,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testAbort() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             //Invalid executor
             assertThrows(log,
                 new Callable<Object>() {
@@ -2010,7 +2102,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     @Test
     public void testGetSetNetworkTimeout() throws Exception {
-        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             // default
             assertEquals(0, conn.getNetworkTimeout());
 
@@ -2058,7 +2150,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
     public void testInvalidNestedTxMode() {
         assertThrows(null, new Callable<Object>() {
             @Override public Object call() throws Exception {
-                DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&nestedTransactionsMode=invalid");
+                DriverManager.getConnection(urlWithAffinityAwarenessProp + "&nestedTransactionsMode=invalid");
 
                 return null;
             }
@@ -2096,7 +2188,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
     public void testSslClientAndPlainServer()  {
         Throwable e = assertThrows(log, new Callable<Object>() {
             @Override public Object call() throws Exception {
-                DriverManager.getConnection(urlWithAffinityAwarenessFlag + "&sslMode=require" +
+                DriverManager.getConnection(urlWithAffinityAwarenessProp + "&sslMode=require" +
                     "&sslClientCertificateKeyStoreUrl=" + CLI_KEY_STORE_PATH +
                     "&sslClientCertificateKeyStorePassword=123456" +
                     "&sslTrustCertificateKeyStoreUrl=" + SRV_KEY_STORE_PATH +
@@ -2127,7 +2219,7 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
 
         final AtomicInteger exCnt = new AtomicInteger(0);
 
-        try (final Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessFlag)) {
+        try (final Connection conn = DriverManager.getConnection(urlWithAffinityAwarenessProp)) {
             final IgniteInternalFuture f = runMultiThreadedAsync(new Runnable() {
                 @Override public void run() {
                     try {
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
index 2b80482..9655f9a 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
@@ -70,6 +70,10 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
     /** URL. */
     private static final String URL = "jdbc:ignite:thin://127.0.0.1/";
 
+    /** URL with affinity awareness enabled. */
+    public static final String URL_AFFINITY_AWARENESS =
+        "jdbc:ignite:thin://127.0.0.1:10800..10801?affinityAwareness=true";
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         return super.getConfiguration(igniteInstanceName)
@@ -1218,8 +1222,17 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
     @Test
     public void testVersions() throws Exception {
         try (Connection conn = DriverManager.getConnection(URL)) {
-            assert conn.getMetaData().getDatabaseProductVersion().equals(IgniteVersionUtils.VER.toString());
-            assert conn.getMetaData().getDriverVersion().equals(IgniteVersionUtils.VER.toString());
+            assertEquals("Unexpected ignite database product version.",
+                conn.getMetaData().getDatabaseProductVersion(), IgniteVersionUtils.VER.toString());
+            assertEquals("Unexpected ignite driver version.",
+                conn.getMetaData().getDriverVersion(), IgniteVersionUtils.VER.toString());
+        }
+
+        try (Connection conn = DriverManager.getConnection(URL_AFFINITY_AWARENESS)) {
+            assertEquals("Unexpected ignite database product version.",
+                conn.getMetaData().getDatabaseProductVersion(), IgniteVersionUtils.VER.toString());
+            assertEquals("Unexpected ignite driver version.",
+                conn.getMetaData().getDriverVersion(), IgniteVersionUtils.VER.toString());
         }
     }
 
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/AffinityCache.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/AffinityCache.java
index bd4dc4b..d13df12 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/AffinityCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/AffinityCache.java
@@ -27,14 +27,6 @@ import org.apache.ignite.internal.util.GridBoundedLinkedHashMap;
  * Affinity Cache.
  */
 public final class AffinityCache {
-    /** Partition distributions cache limit. */
-    // TODO: 09.04.19 IGNITE-11705 Jdbc Thin: add ability to control affinity cache size.
-    public static final int DISTRIBUTIONS_CACHE_LIMIT = 1000;
-
-    /** SQL cache limit. */
-    // TODO: 09.04.19 IGNITE-11705 Jdbc Thin: add ability to control affinity cache size.
-    public static final int SQL_CACHE_LIMIT = 100_000;
-
     /** Affinity topology version. */
     private final AffinityTopologyVersion ver;
 
@@ -49,12 +41,13 @@ public final class AffinityCache {
      *
      * @param ver Affinity topology version.
      */
-    public AffinityCache(AffinityTopologyVersion ver) {
+    public AffinityCache(AffinityTopologyVersion ver, int affinityAwarenessPartDistributionsCacheSize,
+        int affinityAwarenessSQLCacheSize) {
         this.ver = ver;
 
-        cachePartitionsDistribution = new GridBoundedLinkedHashMap<>(DISTRIBUTIONS_CACHE_LIMIT);
+        cachePartitionsDistribution = new GridBoundedLinkedHashMap<>(affinityAwarenessPartDistributionsCacheSize);
 
-        sqlCache = new GridBoundedLinkedHashMap<>(SQL_CACHE_LIMIT);
+        sqlCache = new GridBoundedLinkedHashMap<>(affinityAwarenessSQLCacheSize);
     }
 
     /**
@@ -73,7 +66,7 @@ public final class AffinityCache {
     void addCacheDistribution(Integer cacheId, UUID[] distribution) {
         for (Map.Entry<Integer, UUID[]> entry : cachePartitionsDistribution.entrySet()) {
             if (Arrays.equals(entry.getValue(), distribution)) {
-                // put link to alrady existing distribution instead of creating new one.
+                // put link to already existing distribution instead of creating new one.
                 cachePartitionsDistribution.put(cacheId, entry.getValue());
 
                 return;
@@ -84,7 +77,7 @@ public final class AffinityCache {
     }
 
     /**
-     * Adds sql query with corresponding partion result descriptor.
+     * Adds sql query with corresponding partition result descriptor.
      *
      * @param sql Qualified sql query.
      * @param partRes Partition result descriptor.
@@ -105,7 +98,7 @@ public final class AffinityCache {
 
     /**
      * @param cacheId Cache Id.
-     * @return Cache partitoins distribution for given cache Id or null.
+     * @return Cache partition distribution for given cache Id or null.
      */
     public UUID[] cacheDistribution(int cacheId) {
         return cachePartitionsDistribution.get(cacheId);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionProperties.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionProperties.java
index 038098e..90b21e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionProperties.java
@@ -432,4 +432,31 @@ public interface ConnectionProperties {
      * @throws SQLException On error.
      */
     public void setUpdateBatchSize(@Nullable Integer updateBatchSize) throws SQLException;
+
+    /**
+     * @return SQL cache size that is used within affinity awareness optimizations.
+     */
+    public int getAffinityAwarenessSqlCacheSize();
+
+    /**
+     * Sets SQL cache size that is used within affinity awareness optimizations.
+     *
+     * @param affinityAwarenessSqlCacheSize SQL cache size.
+     * @throws SQLException On error.
+     */
+    public void setAffinityAwarenessSqlCacheSize(int affinityAwarenessSqlCacheSize) throws SQLException;
+
+    /**
+     * @return Partition distributions cache size that is used within affinity awareness optimizations.
+     */
+    public int getAffinityAwarenessPartitionDistributionsCacheSize();
+
+    /**
+     * Sets partition distributions cache size that is used within affinity awareness optimizations.
+     *
+     * @param affinityAwarenessPartDistributionsCacheSize Partition distributions cache size.
+     * @throws SQLException On error.
+     */
+    public void setAffinityAwarenessPartitionDistributionsCacheSize(
+        int affinityAwarenessPartDistributionsCacheSize) throws SQLException;
 }
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionPropertiesImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionPropertiesImpl.java
index c90a278..0237941 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionPropertiesImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionPropertiesImpl.java
@@ -189,7 +189,7 @@ public class ConnectionPropertiesImpl implements ConnectionProperties, Serializa
         "Whether data page scan for queries is allowed. If not specified, server defines the default behaviour.",
         null, false);
 
-    /** affinity awareness flag. */
+    /** Affinity awareness flag. */
     private BooleanProperty affinityAwareness = new BooleanProperty(
         "affinityAwareness",
         "Whether jdbc thin affinity awareness is enabled.",
@@ -201,6 +201,17 @@ public class ConnectionPropertiesImpl implements ConnectionProperties, Serializa
             "Set to 1 to prevent deadlock on update where keys sequence are different " +
             "in several concurrent updates.", null, false, 1, Integer.MAX_VALUE);
 
+    /** Affinity awareness SQL cache size. */
+    private IntegerProperty affinityAwarenessSQLCacheSize = new IntegerProperty("affinityAwarenessSQLCacheSize",
+        "The size of sql cache that is used within affinity awareness optimization.",
+        1_000, false, 1, Integer.MAX_VALUE);
+
+    /** Affinity awareness partition distributions cache size. */
+    private IntegerProperty affinityAwarenessPartDistributionsCacheSize = new IntegerProperty(
+        "affinityAwarenessPartitionDistributionsCacheSize",
+        "The size of partition distributions cache that is used within affinity awareness optimization.",
+        1_000, false, 1, Integer.MAX_VALUE);
+
     /** Properties array. */
     private final ConnectionProperty [] propsArray = {
         distributedJoins, enforceJoinOrder, collocated, replicatedOnly, autoCloseServerCursor,
@@ -212,7 +223,9 @@ public class ConnectionPropertiesImpl implements ConnectionProperties, Serializa
         user, passwd,
         dataPageScanEnabled,
         affinityAwareness,
-        updateBatchSize
+        updateBatchSize,
+        affinityAwarenessSQLCacheSize,
+        affinityAwarenessPartDistributionsCacheSize
     };
 
     /** {@inheritDoc} */
@@ -538,6 +551,29 @@ public class ConnectionPropertiesImpl implements ConnectionProperties, Serializa
         this.updateBatchSize.setValue(updateBatchSize);
     }
 
+    /** {@inheritDoc} */
+    @Override public int getAffinityAwarenessSqlCacheSize() {
+        return affinityAwarenessSQLCacheSize.value();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAffinityAwarenessSqlCacheSize(int affinityAwarenessSQLCacheSize)
+        throws SQLException {
+        this.affinityAwarenessSQLCacheSize.setValue(affinityAwarenessSQLCacheSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getAffinityAwarenessPartitionDistributionsCacheSize() {
+        return affinityAwarenessPartDistributionsCacheSize.value();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAffinityAwarenessPartitionDistributionsCacheSize(
+        int affinityAwarenessPartDistributionsCacheSize) throws SQLException {
+        this.affinityAwarenessPartDistributionsCacheSize.setValue(
+            affinityAwarenessPartDistributionsCacheSize);
+    }
+
     /**
      * @param url URL connection.
      * @param props Environment properties.
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinAffinityAwarenessMappingGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinAffinityAwarenessMappingGroup.java
index 70ce1ae..55a8b31 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinAffinityAwarenessMappingGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinAffinityAwarenessMappingGroup.java
@@ -38,7 +38,7 @@ public class JdbcThinAffinityAwarenessMappingGroup implements JdbcRawBinarylizab
     /** Set of cache Ids. */
     private final Set<Integer> cacheIds = new HashSet<>();
 
-    /** Partitoins mappings. */
+    /** Partitions mappings. */
     private final Map<UUID, Set<Integer>> partitionsMappings;
 
     /**
@@ -62,7 +62,7 @@ public class JdbcThinAffinityAwarenessMappingGroup implements JdbcRawBinarylizab
     }
 
     /**
-     * Tries to merge given partions mappings and corresponding cache id with already existing mappings.
+     * Tries to merge given partitions mappings and corresponding cache id with already existing mappings.
      *
      * @param cacheId Cache id.
      * @param partitionsMappings Partitions mappings.
@@ -82,10 +82,10 @@ public class JdbcThinAffinityAwarenessMappingGroup implements JdbcRawBinarylizab
 
     /**
      * Reverts partitions mappings from the form 'node id -> set of partition ids' to the form 'partition id -> node
-     * id'. First form is more compact, so it's preffered in case of data transfering, second form is easier to use on
+     * id'. First form is more compact, so it's preferred in case of data transferring, second form is easier to use on
      * client side, cause we mainly retrieve data using partition is as key.
      *
-     * @param partsCnt Partitoins count.
+     * @param partsCnt Partitions count.
      * @return Reverted form of partitions mapping: partition id -> node id.
      */
     public UUID[] revertMappings(int partsCnt) {
@@ -146,7 +146,7 @@ public class JdbcThinAffinityAwarenessMappingGroup implements JdbcRawBinarylizab
      *
      * @param reader Binary object reader.
      * @param ver Protocol version.
-     * @return Desirialized instance of <code>JdbcThinAffinityAwarenessMappingGroup</code>.
+     * @return Deserialized instance of <code>JdbcThinAffinityAwarenessMappingGroup</code>.
      * @throws BinaryObjectException In case of error.
      */
     public static JdbcThinAffinityAwarenessMappingGroup readGroup(BinaryReaderExImpl reader,
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
index dec052a..3dddb83 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
@@ -212,6 +212,9 @@ public class JdbcThinConnection implements Connection {
     /** Cancelable future for connections handler task. */
     private ScheduledFuture<?> connectionsHndScheduledFut;
 
+    /** Connections handler timer. */
+    private final IgniteProductVersion baseEndpointVer;
+
     /**
      * Creates new connection.
      *
@@ -229,11 +232,17 @@ public class JdbcThinConnection implements Connection {
 
         affinityAwareness = connProps.isAffinityAwareness();
 
-        ensureConnected();
+        if (affinityAwareness) {
+            baseEndpointVer = connectInBestEffortAffinityMode(null);
 
-        if (affinityAwareness)
             connectionsHndScheduledFut = maintenanceExecutor.scheduleWithFixedDelay(new ConnectionHandlerTask(),
                 0, RECONNECTION_DELAY, TimeUnit.MILLISECONDS);
+        }
+        else {
+            connectInCommonMode();
+
+            baseEndpointVer = null;
+        }
     }
 
     /**
@@ -248,7 +257,7 @@ public class JdbcThinConnection implements Connection {
         assert ios.isEmpty();
 
         if (affinityAwareness)
-            connectInBestEffortAffinityMode();
+            connectInBestEffortAffinityMode(baseEndpointVer);
         else
             connectInCommonMode();
     }
@@ -843,8 +852,12 @@ public class JdbcThinConnection implements Connection {
      * @return Ignite server version.
      */
     IgniteProductVersion igniteVersion() {
-        // TODO: IGNITE-11321: JDBC Thin: implement nodes multi version support.
-        return cliIo(null).igniteVersion();
+        if (affinityAwareness) {
+            return ios.values().stream().map(JdbcThinTcpIo::igniteVersion).min(IgniteProductVersion::compareTo).
+                orElse(baseEndpointVer);
+        }
+        else
+            return singleIo.igniteVersion();
     }
 
     /**
@@ -1052,8 +1065,12 @@ public class JdbcThinConnection implements Connection {
 
         AffinityTopologyVersion resAffinityVer = res.affinityVersion();
 
-        if (affinityCache.version().compareTo(resAffinityVer) < 0)
-            affinityCache = new AffinityCache(resAffinityVer);
+        if (affinityCache.version().compareTo(resAffinityVer) < 0) {
+            affinityCache = new AffinityCache(
+                resAffinityVer,
+                connProps.getAffinityAwarenessPartitionDistributionsCacheSize(),
+                connProps.getAffinityAwarenessSqlCacheSize());
+        }
         else if (affinityCache.version().compareTo(resAffinityVer) > 0) {
             // Jdbc thin affinity cache is binded to the newer affinity topology version, so we should ignore retrieved
             // partition distribution. Given situation might occur in case of concurrent race and is not
@@ -1433,8 +1450,7 @@ public class JdbcThinConnection implements Connection {
      * @return True if query cancellation supported, false otherwise.
      */
     boolean isQueryCancellationSupported() {
-        // TODO: IGNITE-11321: JDBC Thin: implement nodes multi version support.
-        return cliIo(null).isQueryCancellationSupported();
+        return affinityAwareness || singleIo.isQueryCancellationSupported();
     }
 
     /**
@@ -1621,14 +1637,14 @@ public class JdbcThinConnection implements Connection {
      * Establishes a connection to ignite endpoint, trying all specified hosts and ports one by one.
      * Stops as soon as all iosArr are established.
      *
+     * @param baseEndpointVer Base endpoint version.
+     * @return last connected endpoint version.
      * @throws SQLException If failed to connect to at least one ignite endpoint,
-     * or if endpoints versions are not the same.
+     * or if endpoints versions are less than base endpoint version.
      */
-    private void connectInBestEffortAffinityMode() throws SQLException {
+    private IgniteProductVersion connectInBestEffortAffinityMode(IgniteProductVersion baseEndpointVer) throws SQLException {
         List<Exception> exceptions = null;
 
-        IgniteProductVersion prevIgniteEndpointVer = null;
-
         for (int i = 0; i < connProps.getAddresses().length; i++) {
             HostAndPortRange srv = connProps.getAddresses()[i];
 
@@ -1650,13 +1666,15 @@ public class JdbcThinConnection implements Connection {
                                     INTERNAL_ERROR);
                             }
 
-                            if (prevIgniteEndpointVer != null && !prevIgniteEndpointVer.equals(cliIo.igniteVersion())) {
-                                // TODO: 13.02.19 IGNITE-11321 JDBC Thin: implement nodes multi version support.
+                            IgniteProductVersion endpointVer = cliIo.igniteVersion();
+
+                            if (baseEndpointVer != null && baseEndpointVer.compareTo(endpointVer) > 0) {
                                 cliIo.close();
 
                                 throw new SQLException("Failed to connect to Ignite node [url=" +
-                                    connProps.getUrl() + "]. address = [" + addr + ':' + port + "]." +
-                                    "Different versions of nodes are not supported in affinity awareness mode.",
+                                    connProps.getUrl() + "], address = [" + addr + ':' + port + "]," +
+                                    "the node version [" + endpointVer + "] " +
+                                    "is smaller than the base one [" + baseEndpointVer + "].",
                                     INTERNAL_ERROR);
                             }
 
@@ -1671,9 +1689,7 @@ public class JdbcThinConnection implements Connection {
                             else
                                 connCnt.incrementAndGet();
 
-                            prevIgniteEndpointVer = cliIo.igniteVersion();
-
-                            return;
+                            return cliIo.igniteVersion();
                         }
                         catch (Exception exception) {
                             if (exceptions == null)
@@ -1693,6 +1709,8 @@ public class JdbcThinConnection implements Connection {
         }
 
         handleConnectExceptions(exceptions);
+
+        return null;
     }
 
     /**
@@ -1705,8 +1723,12 @@ public class JdbcThinConnection implements Connection {
         if (affinityAwareness) {
             AffinityTopologyVersion resAffVer = res.affinityVersion();
 
-            if (resAffVer != null && (affinityCache == null || affinityCache.version().compareTo(resAffVer) < 0))
-                affinityCache = new AffinityCache(resAffVer);
+            if (resAffVer != null && (affinityCache == null || affinityCache.version().compareTo(resAffVer) < 0)) {
+                affinityCache = new AffinityCache(
+                    resAffVer,
+                    connProps.getAffinityAwarenessPartitionDistributionsCacheSize(),
+                    connProps.getAffinityAwarenessSqlCacheSize());
+            }
 
             // Partition result was requested.
             if (res.response() instanceof JdbcQueryExecuteResult && qryReq.partitionResponseRequest()) {