Repository: ignite
Updated Branches:
  refs/heads/ignite-2.5 28ecf5f3d -> df34d192d


IGNITE-8498: JDBC Thin: Fixed streamer compatibility check. This closes #4002.


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

Branch: refs/heads/ignite-2.5
Commit: df34d192d9a64070a2971fe2910c37acb6359a5b
Parents: 28ecf5f
Author: tledkov-gridgain <tled...@gridgain.com>
Authored: Thu May 17 12:18:45 2018 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Thu May 17 20:35:05 2018 +0300

----------------------------------------------------------------------
 .../internal/jdbc/thin/JdbcThinConnection.java  |  2 +-
 .../internal/jdbc/thin/JdbcThinTcpIo.java       | 31 +++++++++++++++-----
 2 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/df34d192/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
----------------------------------------------------------------------
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 634579b..633d657 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
@@ -189,7 +189,7 @@ public class JdbcThinConnection implements Connection {
 
             // Actual ON, if needed.
             if (newVal) {
-                if (!cmd0.isOrdered()  && 
!cliIo.igniteVersion().greaterThanEqual(2, 5, 0)) {
+                if (!cmd0.isOrdered()  && !cliIo.isUnorderedStreamSupported()) 
{
                     throw new SQLException("Streaming without order doesn't 
supported by server [remoteNodeVer="
                         + cliIo.igniteVersion() + ']', 
SqlStateCode.INTERNAL_ERROR);
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df34d192/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
index 44c1984..2e06095 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
@@ -121,6 +121,9 @@ public class JdbcThinTcpIo {
     /** Mutex. */
     private final Object mux = new Object();
 
+    /** Current protocol version used to connection to Ignite. */
+    private ClientListenerProtocolVersion srvProtocolVer;
+
     /**
      * Constructor.
      *
@@ -342,6 +345,8 @@ public class JdbcThinTcpIo {
             }
             else
                 igniteVer = new IgniteProductVersion((byte)2, (byte)0, 
(byte)0, "Unknown", 0L, null);
+
+            srvProtocolVer = ver;
         }
         else {
             short maj = reader.readShort();
@@ -350,12 +355,12 @@ public class JdbcThinTcpIo {
 
             String err = reader.readString();
 
-            ClientListenerProtocolVersion srvProtocolVer = 
ClientListenerProtocolVersion.create(maj, min, maintenance);
+            ClientListenerProtocolVersion srvProtoVer0 = 
ClientListenerProtocolVersion.create(maj, min, maintenance);
 
-            if (srvProtocolVer.compareTo(VER_2_5_0) < 0 && 
!F.isEmpty(connProps.getUsername())) {
-                throw new SQLException("Authentication doesn't support by 
remote server[driverProtocolVer=" + CURRENT_VER +
-                    ", remoteNodeProtocolVer=" + srvProtocolVer + ", err=" + 
err + ", url=" + connProps.getUrl() + ']',
-                    SqlStateCode.CONNECTION_REJECTED);
+            if (srvProtoVer0.compareTo(VER_2_5_0) < 0 && 
!F.isEmpty(connProps.getUsername())) {
+                throw new SQLException("Authentication doesn't support by 
remote server[driverProtocolVer="
+                    + CURRENT_VER + ", remoteNodeProtocolVer=" + srvProtoVer0 
+ ", err=" + err
+                    + ", url=" + connProps.getUrl() + ']', 
SqlStateCode.CONNECTION_REJECTED);
             }
 
             if (VER_2_4_0.equals(srvProtocolVer) || 
VER_2_3_0.equals(srvProtocolVer) ||
@@ -402,8 +407,11 @@ public class JdbcThinTcpIo {
 
         boolean accepted = reader.readBoolean();
 
-        if (accepted)
+        if (accepted) {
             igniteVer = new IgniteProductVersion((byte)2, (byte)1, (byte)0, 
"Unknown", 0L, null);
+
+            srvProtocolVer = VER_2_1_0;
+        }
         else {
             short maj = reader.readShort();
             short min = reader.readShort();
@@ -435,7 +443,7 @@ public class JdbcThinTcpIo {
         }
 
         try {
-            if (!igniteVer.greaterThanEqual(2, 5, 0)) {
+            if (!isUnorderedStreamSupported()) {
                 throw new SQLException("Streaming without response doesn't 
supported by server [driverProtocolVer="
                     + CURRENT_VER + ", remoteNodeVer=" + igniteVer + ']', 
SqlStateCode.INTERNAL_ERROR);
             }
@@ -619,4 +627,13 @@ public class JdbcThinTcpIo {
     IgniteProductVersion igniteVersion() {
         return igniteVer;
     }
+
+    /**
+     * @return {@code true} If the unordered streaming supported.
+     */
+    boolean isUnorderedStreamSupported() {
+        assert srvProtocolVer != null;
+
+        return srvProtocolVer.compareTo(VER_2_5_0) >= 0;
+    }
 }
\ No newline at end of file

Reply via email to