[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15586832#comment-15586832 ] Laurent Goujon commented on DRILL-4369: --- I just hit the same situation, so I will come up with some proposal > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15586835#comment-15586835 ] ASF GitHub Bot commented on DRILL-4369: --- GitHub user laurentgo opened a pull request: https://github.com/apache/drill/pull/622 DRILL-4369: Exchange name and version infos during handshake There's no name and version exchanged between client and server over the User RPC channel. On client side, having access to the server name and version is useful to expose it to the user (through JDBC or ODBC api like DatabaseMetadata#getDatabaseProductVersion()), or to implement fallback strategy when some recent API are not available (like metadata API). On the server side, having access to the client version might be useful for audit purposes and eventually to implement fallback strategy if it doesn't require a RPC version change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/laurentgo/drill laurent/DRILL-4369-rpc-endpoint-infos Alternatively you can review and apply these changes as the patch at: https://github.com/apache/drill/pull/622.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #622 commit 6767082b64684ce519f5101f386d4758cbd5f03c Author: Laurent Goujon Date: 2016-10-18T22:01:38Z DRILL-4369: Exchange name and version infos during handshake There's no name and version exchanged between client and server over the User RPC channel. On client side, having access to the server name and version is useful to expose it to the user (through JDBC or ODBC api like DatabaseMetadata#getDatabaseProductVersion()), or to implement fallback strategy when some recent API are not available (like metadata API). On the server side, having access to the client version might be useful for audit purposes and eventually to implement fallback strategy if it doesn't require a RPC version change. > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587263#comment-15587263 ] ASF GitHub Bot commented on DRILL-4369: --- Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r83982303 --- Diff: protocol/src/main/java/org/apache/drill/exec/proto/SchemaUserProtos.java --- @@ -255,6 +255,152 @@ public static int getFieldNumber(java.lang.String name) } } +public static final class RpcEndpointInfos --- End diff -- Did you forget to include the modified .proto file ? > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587264#comment-15587264 ] ASF GitHub Bot commented on DRILL-4369: --- Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r83981530 --- Diff: exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java --- @@ -54,6 +55,10 @@ private void throwIfClosed() throws AlreadyClosedSqlException, } } + private RpcEndpointInfos getServerInfos() throws SQLException { +DrillConnectionImpl connection = (DrillConnectionImpl) getConnection(); +return connection.getClient().getServerInfos(); --- End diff -- are guaranteed _connection.getClient()_ won't return null ? > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587262#comment-15587262 ] ASF GitHub Bot commented on DRILL-4369: --- Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r83980514 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -176,6 +180,23 @@ public void setAutoRead(boolean enableAutoRead) { } /** + * Sets the client name. + * + * If not set, default is {@code DrillClient#DEFAULT_CLIENT_NAME}. + * + * @param name the client name + * + * @throws IllegalStateException if called after a connection has been established. + * @throws NullPointerException if client name is empty --- End diff -- it doesn't :P > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587274#comment-15587274 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r83982790 --- Diff: protocol/src/main/java/org/apache/drill/exec/proto/SchemaUserProtos.java --- @@ -255,6 +255,152 @@ public static int getFieldNumber(java.lang.String name) } } +public static final class RpcEndpointInfos --- End diff -- no, it's in the review > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587276#comment-15587276 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r83982861 --- Diff: exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java --- @@ -54,6 +55,10 @@ private void throwIfClosed() throws AlreadyClosedSqlException, } } + private RpcEndpointInfos getServerInfos() throws SQLException { +DrillConnectionImpl connection = (DrillConnectionImpl) getConnection(); +return connection.getClient().getServerInfos(); --- End diff -- yes, because the client is initialized as part of the constructor of DrillConnectionImpl (the field is final too) > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587277#comment-15587277 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r83982899 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -176,6 +180,23 @@ public void setAutoRead(boolean enableAutoRead) { } /** + * Sets the client name. + * + * If not set, default is {@code DrillClient#DEFAULT_CLIENT_NAME}. + * + * @param name the client name + * + * @throws IllegalStateException if called after a connection has been established. + * @throws NullPointerException if client name is empty --- End diff -- it should be changed to if client name is null > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587318#comment-15587318 ] ASF GitHub Bot commented on DRILL-4369: --- Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r83983884 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -176,6 +180,23 @@ public void setAutoRead(boolean enableAutoRead) { } /** + * Sets the client name. + * + * If not set, default is {@code DrillClient#DEFAULT_CLIENT_NAME}. + * + * @param name the client name + * + * @throws IllegalStateException if called after a connection has been established. + * @throws NullPointerException if client name is empty --- End diff -- you are not checking if the name is null > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587315#comment-15587315 ] ASF GitHub Bot commented on DRILL-4369: --- Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r83983836 --- Diff: protocol/src/main/java/org/apache/drill/exec/proto/SchemaUserProtos.java --- @@ -255,6 +255,152 @@ public static int getFieldNumber(java.lang.String name) } } +public static final class RpcEndpointInfos --- End diff -- my bad > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589516#comment-15589516 ] ASF GitHub Bot commented on DRILL-4369: --- Github user julienledem commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84140015 --- Diff: exec/jdbc/src/test/java/org/apache/drill/jdbc/DriverTest.java --- @@ -17,6 +17,15 @@ */ package org.apache.drill.jdbc; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.instanceOf; +//import static org.hamcrest.CoreMatchers.*; --- End diff -- to remove? > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589520#comment-15589520 ] ASF GitHub Bot commented on DRILL-4369: --- Github user julienledem commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84139632 --- Diff: exec/jdbc-all/src/test/java/org/apache/drill/jdbc/ITTestShadedJar.java --- @@ -67,6 +70,33 @@ public void run() { } @Test + public void testDatabaseVersion() throws Exception { + +// print class path for debugging +System.out.println("java.class.path:"); +System.out.println(System.getProperty("java.class.path")); --- End diff -- log? > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589521#comment-15589521 ] ASF GitHub Bot commented on DRILL-4369: --- Github user julienledem commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84140755 --- Diff: exec/java-exec/src/main/codegen/templates/DrillVersionInfo.java --- @@ -0,0 +1,97 @@ +/*** + * 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. + **/ + +<@pp.dropOutputFile /> + +<@pp.changeOutputFile name="/org/apache/drill/common/util/DrillVersionInfo.java" /> + +<#include "/@includes/license.ftl" /> + +package org.apache.drill.common.util; + +import java.text.MessageFormat; +import java.text.ParseException; + +/** + * This file is generated with Freemarker using the template src/main/codegen/templates/DrillVersionInfo.java + */ +public class DrillVersionInfo { + private static final String VERSION = "${maven.version}"; + + private static final int MAJOR_VERSION; + private static final int MINOR_VERSION; + private static final int PATCH_VERSION; + + static { + final int[] parseResults; + try { +parseResults = parseVersion(VERSION); +if (parseResults == null || parseResults.length < 3) { + throw new AssertionError("An error occured when parsing Drill Version"); --- End diff -- I'd put that check in parseVersion > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589517#comment-15589517 ] ASF GitHub Bot commented on DRILL-4369: --- Github user julienledem commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84139272 --- Diff: exec/java-exec/src/main/codegen/templates/DrillVersionInfo.java --- @@ -0,0 +1,97 @@ +/*** + * 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. + **/ + +<@pp.dropOutputFile /> + +<@pp.changeOutputFile name="/org/apache/drill/common/util/DrillVersionInfo.java" /> + +<#include "/@includes/license.ftl" /> + +package org.apache.drill.common.util; + +import java.text.MessageFormat; +import java.text.ParseException; + +/** + * This file is generated with Freemarker using the template src/main/codegen/templates/DrillVersionInfo.java + */ +public class DrillVersionInfo { + private static final String VERSION = "${maven.version}"; + + private static final int MAJOR_VERSION; + private static final int MINOR_VERSION; + private static final int PATCH_VERSION; + + static { + final int[] parseResults; + try { +parseResults = parseVersion(VERSION); +if (parseResults == null || parseResults.length < 3) { + throw new AssertionError("An error occured when parsing Drill Version"); +} + } catch(ParseException e) { +throw new AssertionError("An error occured when parsing Drill Version", e); + } + MAJOR_VERSION = parseResults[0]; + MINOR_VERSION = parseResults[1]; + PATCH_VERSION = parseResults[2]; + } + + static int[] parseVersion(String version) throws ParseException { +final MessageFormat versionFormat = new MessageFormat("{0,number,integer}.{1,number,integer}.{2,number,integer}"); + +Object[] parseResult = versionFormat.parse(version); +int[] result = new int[parseResult.length]; +for(int i = 0; i Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589518#comment-15589518 ] ASF GitHub Bot commented on DRILL-4369: --- Github user julienledem commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84139699 --- Diff: exec/jdbc-all/src/test/java/org/apache/drill/jdbc/ITTestShadedJar.java --- @@ -67,6 +70,33 @@ public void run() { } @Test + public void testDatabaseVersion() throws Exception { + +// print class path for debugging +System.out.println("java.class.path:"); +System.out.println(System.getProperty("java.class.path")); + +final URLClassLoader loader = (URLClassLoader) ClassLoader.getSystemClassLoader(); +Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); +method.setAccessible(true); +method.invoke(loader, getJdbcUrl()); + +Class clazz = loader.loadClass("org.apache.drill.jdbc.Driver"); +try { + Driver driver = (Driver) clazz.newInstance(); + try (Connection c = driver.connect("jdbc:drill:drillbit=localhost:31010", null)) { +DatabaseMetaData metadata = c.getMetaData(); +assertEquals("Apache Drill JDBC Driver", metadata.getDriverName()); +assertEquals("Apache Drill Server", metadata.getDatabaseProductName()); +//assertEquals() + } +} catch (Exception ex) { + throw ex; --- End diff -- needed? > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589519#comment-15589519 ] ASF GitHub Bot commented on DRILL-4369: --- Github user julienledem commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84139026 --- Diff: exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java --- @@ -96,6 +96,8 @@ protected DrillConnectionImpl(DriverImpl driver, AvaticaFactory factory, this.config = new DrillConnectionConfig(info); try { + String connect = null; --- End diff -- no need for = null since it is set in every branch bellow? > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589572#comment-15589572 ] ASF GitHub Bot commented on DRILL-4369: --- Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84145164 --- Diff: exec/java-exec/src/main/codegen/templates/DrillVersionInfo.java --- @@ -0,0 +1,97 @@ +/*** + * 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. + **/ + +<@pp.dropOutputFile /> + +<@pp.changeOutputFile name="/org/apache/drill/common/util/DrillVersionInfo.java" /> + +<#include "/@includes/license.ftl" /> + +package org.apache.drill.common.util; + +import java.text.MessageFormat; +import java.text.ParseException; + +/** + * This file is generated with Freemarker using the template src/main/codegen/templates/DrillVersionInfo.java + */ +public class DrillVersionInfo { + private static final String VERSION = "${maven.version}"; + + private static final int MAJOR_VERSION; + private static final int MINOR_VERSION; + private static final int PATCH_VERSION; + + static { + final int[] parseResults; + try { +parseResults = parseVersion(VERSION); +if (parseResults == null || parseResults.length < 3) { + throw new AssertionError("An error occured when parsing Drill Version"); +} + } catch(ParseException e) { +throw new AssertionError("An error occured when parsing Drill Version", e); --- End diff -- just curious, why not use defaults when we can't parse the version ? depending on when this exception is thrown, I'm not sure it will be easy for the user to figure out what went wrong > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589579#comment-15589579 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84145465 --- Diff: exec/java-exec/src/main/codegen/templates/DrillVersionInfo.java --- @@ -0,0 +1,97 @@ +/*** + * 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. + **/ + +<@pp.dropOutputFile /> + +<@pp.changeOutputFile name="/org/apache/drill/common/util/DrillVersionInfo.java" /> + +<#include "/@includes/license.ftl" /> + +package org.apache.drill.common.util; + +import java.text.MessageFormat; +import java.text.ParseException; + +/** + * This file is generated with Freemarker using the template src/main/codegen/templates/DrillVersionInfo.java + */ +public class DrillVersionInfo { + private static final String VERSION = "${maven.version}"; + + private static final int MAJOR_VERSION; + private static final int MINOR_VERSION; + private static final int PATCH_VERSION; + + static { + final int[] parseResults; + try { +parseResults = parseVersion(VERSION); +if (parseResults == null || parseResults.length < 3) { + throw new AssertionError("An error occured when parsing Drill Version"); --- End diff -- will be removed > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589583#comment-15589583 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84145567 --- Diff: exec/jdbc-all/src/test/java/org/apache/drill/jdbc/ITTestShadedJar.java --- @@ -67,6 +70,33 @@ public void run() { } @Test + public void testDatabaseVersion() throws Exception { + +// print class path for debugging +System.out.println("java.class.path:"); +System.out.println(System.getProperty("java.class.path")); --- End diff -- this class needs a serious refactoring, but I'm hesitant of doing it in that patch > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590114#comment-15590114 ] ASF GitHub Bot commented on DRILL-4369: --- Github user asfgit closed the pull request at: https://github.com/apache/drill/pull/622 > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590186#comment-15590186 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84155576 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserRpcUtils.java --- @@ -0,0 +1,59 @@ +/* + * 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.drill.exec.rpc.user; + +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; + +import org.apache.drill.common.util.DrillVersionInfo; +import org.apache.drill.exec.proto.UserProtos.RpcEndpointInfos; + +import com.google.common.base.Preconditions; + +/** + * Utility class for User RPC + * + */ +public final class UserRpcUtils { + private UserRpcUtils() {} + + /** + * Returns a {@code RpcEndpointInfos} instance + * + * The instance is populated based on Drill version informations + * from the classpath and runtime information for the application + * name. + * + * @param name the endpoint name. + * @return a {@code RpcEndpointInfos} instance + * @throws NullPointerException if name is null + */ + public static RpcEndpointInfos getRpcEndpointInfos(String name) { --- End diff -- Infos -> Info > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590194#comment-15590194 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84155289 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java --- @@ -71,9 +75,14 @@ public UserClient(DrillConfig config, boolean supportComplexTypes, BufferAllocat BitToUserHandshake.class, BitToUserHandshake.PARSER, "user client"); +this.clientName = clientName; this.supportComplexTypes = supportComplexTypes; } + public RpcEndpointInfos getServerInfos() { --- End diff -- Infos -> Info > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590190#comment-15590190 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84152744 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -330,6 +352,19 @@ public void close() { connected = false; } + + /** + * Return the server infos. Only available after connecting + * + * The result might be null if the server doesn't provide the informations. + * + * @return the server informations, or null if not connected or if the server + * doesn't provide the information + */ + public RpcEndpointInfos getServerInfos() { --- End diff -- Infos -> Info "Information" is already plural. > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590192#comment-15590192 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84153194 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -330,6 +352,19 @@ public void close() { connected = false; } + + /** + * Return the server infos. Only available after connecting --- End diff -- Please explain what the "server info" is and we get it from the client object. Is this information about the server associated with this particular client connection? Information provided to the server by this client? Something else? > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590188#comment-15590188 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84153946 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -98,6 +100,8 @@ * String into ByteBuf. */ public class DrillClient implements Closeable, ConnectionThrottle { + public static final String DEFAULT_CLIENT_NAME = "Apache Drill Java client"; --- End diff -- Isn't there a C++ client? Perhaps the default name should be "Undefined Drill client" to allow for this case. > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590189#comment-15590189 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84187250 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java --- @@ -71,8 +63,16 @@ import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.MessageLite; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.socket.SocketChannel; + public class UserServer extends BasicServer { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(UserServer.class); + private static final String SERVER_NAME = "Apache Drill Server"; --- End diff -- Apache Drill Drillbit? We seem to call our servers "Drillbits." > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590193#comment-15590193 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84154532 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -176,6 +181,23 @@ public void setAutoRead(boolean enableAutoRead) { } /** + * Sets the client name. + * + * If not set, default is {@code DrillClient#DEFAULT_CLIENT_NAME}. + * + * @param name the client name + * + * @throws IllegalStateException if called after a connection has been established. + * @throws NullPointerException if client name is null --- End diff -- Old clients won't know to provide a name. The name will thus be null. But, we throw an NPE in this case. Two issues. First, is an NPE the right way to communicate to a (new) client that it failed to follow the (now required) protocol? Should this be translated to some kind of protocol exception somewhere? If so, how will we know that this is an NPE from a protocol error vs just a code bug? Second, where do we handle the case that a client does not provide a name? There should be a reasonable default (which seems to be the default name, but this bit is no exactly clear.) > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590191#comment-15590191 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84153322 --- Diff: exec/java-exec/src/main/codegen/templates/DrillVersionInfo.java --- @@ -0,0 +1,71 @@ +/*** + * 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. + **/ + --- End diff -- Nice use of Freemarker! > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590187#comment-15590187 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84153766 --- Diff: exec/java-exec/src/main/codegen/templates/DrillVersionInfo.java --- @@ -0,0 +1,71 @@ +/*** + * 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. + **/ + +<@pp.dropOutputFile /> + +<@pp.changeOutputFile name="/org/apache/drill/common/util/DrillVersionInfo.java" /> + +<#include "/@includes/license.ftl" /> + +package org.apache.drill.common.util; + +import java.text.MessageFormat; +import java.text.ParseException; + +/** + * This file is generated with Freemarker using the template src/main/codegen/templates/DrillVersionInfo.java + */ +public class DrillVersionInfo { + private static final String VERSION = "${maven.project.version}"; + + private static final int MAJOR_VERSION = ${maven.project.artifact.selectedVersion.majorVersion}; + private static final int MINOR_VERSION = ${maven.project.artifact.selectedVersion.minorVersion}; + private static final int PATCH_VERSION = ${maven.project.artifact.selectedVersion.incrementalVersion}; --- End diff -- Allow a suffix? Drill 1.9.0-SNAPSHOT or Drill 1.9.0-Fix17 There is a big difference between, say a SNAPSHOT version and the released version... > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590195#comment-15590195 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84152957 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -176,6 +181,23 @@ public void setAutoRead(boolean enableAutoRead) { } /** + * Sets the client name. --- End diff -- Ambiguous. What "client name"? The name of the user? The name of the client application? The name of the client API? ... Please explain. > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590226#comment-15590226 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84188853 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -98,6 +100,8 @@ * String into ByteBuf. */ public class DrillClient implements Closeable, ConnectionThrottle { + public static final String DEFAULT_CLIENT_NAME = "Apache Drill Java client"; --- End diff -- Also, since I already have a big C++ patch in progress, the C++ change will be done in that branch > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590232#comment-15590232 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84189164 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -330,6 +352,19 @@ public void close() { connected = false; } + + /** + * Return the server infos. Only available after connecting + * + * The result might be null if the server doesn't provide the informations. + * + * @return the server informations, or null if not connected or if the server + * doesn't provide the information + */ + public RpcEndpointInfos getServerInfos() { --- End diff -- I learned something :) > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590236#comment-15590236 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84189349 --- Diff: exec/java-exec/src/main/codegen/templates/DrillVersionInfo.java --- @@ -0,0 +1,71 @@ +/*** + * 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. + **/ + --- End diff -- Credits to @julienledem for the idea > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590237#comment-15590237 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84189362 --- Diff: exec/java-exec/src/main/codegen/templates/DrillVersionInfo.java --- @@ -0,0 +1,71 @@ +/*** + * 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. + **/ + +<@pp.dropOutputFile /> + +<@pp.changeOutputFile name="/org/apache/drill/common/util/DrillVersionInfo.java" /> + +<#include "/@includes/license.ftl" /> + +package org.apache.drill.common.util; + +import java.text.MessageFormat; +import java.text.ParseException; + +/** + * This file is generated with Freemarker using the template src/main/codegen/templates/DrillVersionInfo.java + */ +public class DrillVersionInfo { + private static final String VERSION = "${maven.project.version}"; + + private static final int MAJOR_VERSION = ${maven.project.artifact.selectedVersion.majorVersion}; + private static final int MINOR_VERSION = ${maven.project.artifact.selectedVersion.minorVersion}; + private static final int PATCH_VERSION = ${maven.project.artifact.selectedVersion.incrementalVersion}; --- End diff -- yes, that's why I added a big javadoc notice to rely on the version string for semver. Technically we should also add the build version if we wanted to be maven compatible > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590243#comment-15590243 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/622#discussion_r84189493 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java --- @@ -71,8 +63,16 @@ import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.MessageLite; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.socket.SocketChannel; + public class UserServer extends BasicServer { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(UserServer.class); + private static final String SERVER_NAME = "Apache Drill Server"; --- End diff -- I was thinking Apache Drill User Server too based on the class name > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15590245#comment-15590245 ] ASF GitHub Bot commented on DRILL-4369: --- Github user laurentgo commented on the issue: https://github.com/apache/drill/pull/622 @paul-rogers I missed your comments, but I don't mind doing a follow up. Let me know > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15613378#comment-15613378 ] ASF GitHub Bot commented on DRILL-4369: --- Github user paul-rogers commented on the issue: https://github.com/apache/drill/pull/622 Thanks for the responses! Sorry I posted my comments just after the commit. The issues are "nice-to-haves" for the original PR, do not justify another PR. > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell >Assignee: Laurent Goujon > Fix For: 1.9.0 > > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4369) Database driver fails to report any major or minor version information
[ https://issues.apache.org/jira/browse/DRILL-4369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15634700#comment-15634700 ] Chun Chang commented on DRILL-4369: --- verified. Product name = Apache Drill Server Product version = 1.9.0-SNAPSHOT Driver name = Apache Drill JDBC Driver Driver version = 1.9.0-SNAPSHOT > Database driver fails to report any major or minor version information > -- > > Key: DRILL-4369 > URL: https://issues.apache.org/jira/browse/DRILL-4369 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC >Affects Versions: 1.4.0 >Reporter: N Campbell >Assignee: Laurent Goujon > Fix For: 1.9.0 > > > Using Apache 1.4 Drill > The DatabaseMetadata.getters to obtain the Major and Minor versions of the > server or JDBC driver return 0 instead of 1.4. > This prevents an application from dynamically adjusting how it interacts > based on which version of Drill a connection is accessing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)