You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/10/09 14:48:42 UTC
[47/50] [abbrv] ignite git commit: IGNITE-6529: JDBC thin: fixed
driver protocol compatibility. This closes #2819.
IGNITE-6529: JDBC thin: fixed driver protocol compatibility. This closes #2819.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dc514c70
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dc514c70
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dc514c70
Branch: refs/heads/ignite-6305
Commit: dc514c7083bc5529c886f6cce3d600663733e6d7
Parents: 3184437
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Oct 9 15:14:23 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Oct 9 15:14:23 2017 +0300
----------------------------------------------------------------------
.../internal/jdbc/thin/JdbcThinTcpIo.java | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc514c70/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 688f908..9e12fbf 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
@@ -49,6 +49,9 @@ public class JdbcThinTcpIo {
/** Version 2.1.0. */
private static final ClientListenerProtocolVersion VER_2_1_0 = ClientListenerProtocolVersion.create(2, 1, 0);
+ /** Version 2.1.5: added "lazy" flag. */
+ private static final ClientListenerProtocolVersion VER_2_1_5 = ClientListenerProtocolVersion.create(2, 1, 5);
+
/** Version 2.3.1. */
private static final ClientListenerProtocolVersion VER_2_3_0 = ClientListenerProtocolVersion.create(2, 3, 0);
@@ -180,22 +183,25 @@ public class JdbcThinTcpIo {
SqlStateCode.CLIENT_CONNECTION_FAILED, e);
}
- handshake();
+ handshake(CURRENT_VER);
}
/**
+ * Used for versions: 2.1.5 and 2.3.0. The protocol version is changed but handshake format isn't changed.
+ *
+ * @param ver JDBC client version.
* @throws IOException On IO error.
* @throws SQLException On connection reject.
*/
- public void handshake() throws IOException, SQLException {
+ public void handshake(ClientListenerProtocolVersion ver) throws IOException, SQLException {
BinaryWriterExImpl writer = new BinaryWriterExImpl(null, new BinaryHeapOutputStream(HANDSHAKE_MSG_SIZE),
null, null);
writer.writeByte((byte) ClientListenerRequest.HANDSHAKE);
- writer.writeShort(CURRENT_VER.major());
- writer.writeShort(CURRENT_VER.minor());
- writer.writeShort(CURRENT_VER.maintenance());
+ writer.writeShort(ver.major());
+ writer.writeShort(ver.minor());
+ writer.writeShort(ver.maintenance());
writer.writeByte(ClientListenerNioListener.JDBC_CLIENT);
@@ -238,7 +244,9 @@ public class JdbcThinTcpIo {
ClientListenerProtocolVersion srvProtocolVer = ClientListenerProtocolVersion.create(maj, min, maintenance);
- if (VER_2_1_0.equals(srvProtocolVer))
+ if (VER_2_1_5.equals(srvProtocolVer))
+ handshake(VER_2_1_5);
+ else if (VER_2_1_0.equals(srvProtocolVer))
handshake_2_1_0();
else {
throw new SQLException("Handshake failed [driverProtocolVer=" + CURRENT_VER +