Skip to content

Commit

Permalink
Merge branch 'master' into Snow-732360-Allow-Connection-Caching-to-be…
Browse files Browse the repository at this point in the history
…-Disabled
  • Loading branch information
sfc-gh-ext-simba-jf committed Aug 28, 2024
2 parents 9ac1b57 + 41582e8 commit ba32b46
Show file tree
Hide file tree
Showing 35 changed files with 680 additions and 386 deletions.
6 changes: 3 additions & 3 deletions FIPS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@
</configuration>
</execution>
<execution>
<id>install-arrow-memory-netty</id>
<id>install-arrow-memory-netty-buffer-patch</id>
<phase>validate</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${basedir}/../dependencies/arrow-memory-netty-${arrow.version}.jar</file>
<file>${basedir}/../dependencies/arrow-memory-netty-buffer-patch-${arrow.version}.jar</file>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
<artifactId>arrow-memory-netty-buffer-patch</artifactId>
<version>${arrow.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
Expand Down
14 changes: 7 additions & 7 deletions TestOnly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<arrow.version>10.0.1</arrow.version>
<arrow.version>17.0.0</arrow.version>
<awaitility.version>4.2.0</awaitility.version>
<jacksondatabind.version>2.13.4.2</jacksondatabind.version>
<jacksondatabind.version>2.17.2</jacksondatabind.version>
<jacoco.version>0.8.4</jacoco.version>
<jacoco.skip.instrument>true</jacoco.skip.instrument>
<jna.version>5.13.0</jna.version>
Expand All @@ -27,12 +27,12 @@
<dependency> <!-- netty is not a direct dependency. It is used by arrow-vector -->
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.77.Final</version>
<version>4.1.111.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.77.Final</version>
<version>4.1.111.Final</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -165,7 +165,7 @@
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
<artifactId>arrow-memory-netty-buffer-patch</artifactId>
<version>${arrow.version}</version>
<exclusions>
<exclusion> <!-- Exclude earlier version to avoid whitesource vulnerability. -->
Expand Down Expand Up @@ -285,13 +285,13 @@
</configuration>
</execution>
<execution>
<id>install-arrow-memory-netty</id>
<id>install-arrow-memory-netty-buffer-patch</id>
<phase>validate</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/../dependencies/arrow-memory-netty-${arrow.version}.jar</file>
<file>${project.basedir}/../dependencies/arrow-memory-netty-buffer-patch-${arrow.version}.jar</file>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
<version>${arrow.version}</version>
Expand Down
4 changes: 2 additions & 2 deletions dependencies/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Arrow dependencies are built from internal branch `upgradeTo10.0.1-v2`.
The artifacts should have version 10.0.2, but on maven central there is no higher version of arrow 10.x artifacts and maven build fails at the beginning of parsing pom, when dependencies are downloaded when we try to set higher version e.g. 10.0.2 so we need to keep old version `10.0.1` and let maven to download artifacts first and then we can replace them in the build process.
Arrow dependencies are built from internal branch `upgradeto17.0.0`. This build was applied the AIX fix.

Binary file removed dependencies/arrow-format-10.0.1.jar
Binary file not shown.
Binary file added dependencies/arrow-format-17.0.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>10.0.1</version>
<version>17.0.0</version>
</parent>
<artifactId>arrow-memory</artifactId>
<name>Arrow Memory</name>
Expand All @@ -23,7 +23,7 @@
<modules>
<module>memory-core</module>
<module>memory-unsafe</module>
<module>memory-netty</module>
<module>memory-netty-buffer-patch</module>
</modules>

</project>
Binary file removed dependencies/arrow-memory-core-10.0.1.jar
Binary file not shown.
Binary file added dependencies/arrow-memory-core-17.0.0.jar
Binary file not shown.
Binary file removed dependencies/arrow-memory-netty-10.0.1.jar
Binary file not shown.
Binary file not shown.
Binary file removed dependencies/arrow-memory-unsafe-10.0.1.jar
Binary file not shown.
Binary file added dependencies/arrow-memory-unsafe-17.0.0.jar
Binary file not shown.
Binary file removed dependencies/arrow-vector-10.0.1.jar
Binary file not shown.
Binary file added dependencies/arrow-vector-17.0.0.jar
Binary file not shown.
18 changes: 9 additions & 9 deletions parent-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<apache.commons.text.version>1.10.0</apache.commons.text.version>
<apache.httpclient.version>4.5.14</apache.httpclient.version>
<apache.httpcore.version>4.4.16</apache.httpcore.version>
<arrow.version>10.0.1</arrow.version>
<arrow.version>17.0.0</arrow.version>
<asm.version>9.3</asm.version>
<avro.version>1.8.1</avro.version>
<awaitility.version>4.2.0</awaitility.version>
<awssdk.version>1.12.501</awssdk.version>
<awssdk.version>1.12.655</awssdk.version>
<azure.storage.version>5.0.0</azure.storage.version>
<bouncycastle.version>1.74</bouncycastle.version>
<bouncycastle.bcfips.version>1.0.2.4</bouncycastle.bcfips.version>
Expand All @@ -32,7 +32,7 @@
<classworlds.version>1.1</classworlds.version>
<checkerframework.version>3.33.0</checkerframework.version>
<commons.cli.version>1.2</commons.cli.version>
<commons.codec.version>1.15</commons.codec.version>
<commons.codec.version>1.17.0</commons.codec.version>
<commons.dbcp.version>1.4</commons.dbcp.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.logging.version>1.2</commons.logging.version>
Expand All @@ -44,7 +44,7 @@
<google.cloud.storage.version>2.22.6</google.cloud.storage.version>
<google.code.gson.version>2.10.1</google.code.gson.version>
<google.errorprone.version>2.18.0</google.errorprone.version>
<google.flatbuffers.version>1.12.0</google.flatbuffers.version>
<google.flatbuffers.version>24.3.25</google.flatbuffers.version>
<google.gax.version>2.31.0</google.gax.version>
<google.guava.version>32.1.1-jre</google.guava.version>
<google.http.client.version>1.43.3</google.http.client.version>
Expand All @@ -53,7 +53,7 @@
<grpc.version>1.60.0</grpc.version>
<hamcrest.version>2.2</hamcrest.version>
<hikaricp.version>2.4.3</hikaricp.version>
<jackson.version>2.15.3</jackson.version>
<jackson.version>2.17.2</jackson.version>
<jacoco.skip.instrument>true</jacoco.skip.instrument>
<javax.servlet.version>3.1.0</javax.servlet.version>
<jna.version>5.13.0</jna.version>
Expand All @@ -73,7 +73,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<relocationBase>net/snowflake/client/jdbc/internal</relocationBase>
<shadeBase>net.snowflake.client.jdbc.internal</shadeBase>
<slf4j.version>2.0.6</slf4j.version>
<slf4j.version>2.0.13</slf4j.version>
<snowflake.common.version>5.1.4</snowflake.common.version>
<testCategory>net.snowflake.client.category.AllTestCategory</testCategory>
<threeten.version>1.6.9</threeten.version>
Expand All @@ -98,7 +98,7 @@
<version.plugin.jar>3.3.0</version.plugin.jar>
<version.plugin.javadoc>3.5.0</version.plugin.javadoc>
<version.plugin.projectinforeports>3.4.2</version.plugin.projectinforeports>
<version.plugin.shade>3.4.1</version.plugin.shade>
<version.plugin.shade>3.6.0</version.plugin.shade>
<version.plugin.sortpom>3.0.1</version.plugin.sortpom>
<version.plugin.source>3.2.1</version.plugin.source>
<version.plugin.surefire>3.0.0</version.plugin.surefire>
Expand Down Expand Up @@ -402,7 +402,7 @@
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
<artifactId>arrow-memory-netty-buffer-patch</artifactId>
<version>${arrow.version}</version>
<scope>runtime</scope>
</dependency>
Expand Down Expand Up @@ -680,7 +680,7 @@
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
<artifactId>arrow-memory-netty-buffer-patch</artifactId>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,15 @@
</configuration>
</execution>
<execution>
<id>install-arrow-memory-netty</id>
<id>install-arrow-memory-netty-buffer-patch</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
<configuration>
<file>${project.basedir}/dependencies/arrow-memory-netty-${arrow.version}.jar</file>
<file>${project.basedir}/dependencies/arrow-memory-netty-buffer-patch-${arrow.version}.jar</file>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
<artifactId>arrow-memory-netty-buffer-patch</artifactId>
<version>${arrow.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
Expand Down Expand Up @@ -1026,21 +1026,21 @@
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/21/${relocationBase}"/>
<!-- org.bouncycastle.* packages are relocated to ${relocationBase}.org.bouncycastle.* -->
<move file="${project.build.directory}/relocate/META-INF/versions/9/org" todir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/11/org" todir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/15/org" todir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
<!-- com.fasterxml.* packages are relocated to ${relocationBase}.fasterxml.* -->
<move file="${project.build.directory}/relocate/META-INF/versions/11/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/17/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/19/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/21/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/21/${relocationBase}"/>
<zip basedir="${project.build.directory}/relocate" destfile="${project.build.directory}/${project.build.finalName}.jar"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/21/${relocationBase}"/>
</target>
</configuration>
</execution>
Expand Down
29 changes: 19 additions & 10 deletions src/main/java/net/snowflake/client/core/HttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ public class HttpUtil {
static final int DEFAULT_DOWNLOADED_CONDITION_TIMEOUT = 3600; // secs

public static final String JDBC_TTL = "net.snowflake.jdbc.ttl";
static final String JDBC_CONNECTION_TIMEOUT_IN_MS_PROPERTY =
"net.snowflake.jdbc.http_client_connection_timeout_in_ms";
static final String JDBC_SOCKET_TIMEOUT_IN_MS_PROPERTY =
"net.snowflake.jdbc.http_client_socket_timeout_in_ms";
public static final String JDBC_MAX_CONNECTIONS_PROPERTY = "net.snowflake.jdbc.max_connections";
public static final String JDBC_MAX_CONNECTIONS_PER_ROUTE_PROPERTY =
"net.snowflake.jdbc.max_connections_per_route";

private static Duration connectionTimeout;
private static Duration socketTimeout;

/**
* The unique httpClient shared by all connections. This will benefit long-lived clients. Key =
* proxy host + proxy port + nonProxyHosts, Value = Map of [OCSPMode, HttpClient]
Expand Down Expand Up @@ -114,16 +113,26 @@ public class HttpUtil {

@SnowflakeJdbcInternalApi
public static Duration getConnectionTimeout() {
return Duration.ofMillis(
SystemUtil.convertSystemPropertyToIntValue(
JDBC_CONNECTION_TIMEOUT_IN_MS_PROPERTY, DEFAULT_HTTP_CLIENT_CONNECTION_TIMEOUT_IN_MS));
return connectionTimeout != null
? connectionTimeout
: Duration.ofMillis(DEFAULT_HTTP_CLIENT_CONNECTION_TIMEOUT_IN_MS);
}

@SnowflakeJdbcInternalApi
public static Duration getSocketTimeout() {
return Duration.ofMillis(
SystemUtil.convertSystemPropertyToIntValue(
JDBC_SOCKET_TIMEOUT_IN_MS_PROPERTY, DEFAULT_HTTP_CLIENT_SOCKET_TIMEOUT_IN_MS));
return socketTimeout != null
? socketTimeout
: Duration.ofMillis(DEFAULT_HTTP_CLIENT_SOCKET_TIMEOUT_IN_MS);
}

@SnowflakeJdbcInternalApi
public static void setConnectionTimeout(int timeout) {
connectionTimeout = Duration.ofMillis(timeout);
}

@SnowflakeJdbcInternalApi
public static void setSocketTimeout(int timeout) {
socketTimeout = Duration.ofMillis(timeout);
}

public static long getDownloadedConditionTimeoutInSeconds() {
Expand Down
30 changes: 23 additions & 7 deletions src/main/java/net/snowflake/client/core/SFLoginInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public class SFLoginInput {
private OCSPMode ocspMode;
private HttpClientSettingsKey httpClientKey;
private String privateKeyFile;
private String privateKeyFilePwd;
private String privateKeyBase64;
private String privateKeyPwd;
private String inFlightCtx; // Opaque string sent for Snowsight account activation

private boolean disableConsoleLogin = true;
Expand Down Expand Up @@ -228,8 +229,8 @@ public SFLoginInput setToken(String token) {
return this;
}

Duration getConnectionTimeout() {
return connectionTimeout;
int getConnectionTimeoutInMillis() {
return (int) connectionTimeout.toMillis();
}

SFLoginInput setConnectionTimeout(Duration connectionTimeout) {
Expand Down Expand Up @@ -327,22 +328,37 @@ SFLoginInput setPrivateKey(PrivateKey privateKey) {
return this;
}

String getPrivateKeyBase64() {
return privateKeyBase64;
}

SFLoginInput setPrivateKeyBase64(String privateKeyBase64) {
this.privateKeyBase64 = privateKeyBase64;
return this;
}

SFLoginInput setPrivateKeyFile(String privateKeyFile) {
this.privateKeyFile = privateKeyFile;
return this;
}

SFLoginInput setPrivateKeyFilePwd(String privateKeyFilePwd) {
this.privateKeyFilePwd = privateKeyFilePwd;
SFLoginInput setPrivateKeyPwd(String privateKeyPwd) {
this.privateKeyPwd = privateKeyPwd;
return this;
}

String getPrivateKeyFile() {
return privateKeyFile;
}

String getPrivateKeyFilePwd() {
return privateKeyFilePwd;
String getPrivateKeyPwd() {
return privateKeyPwd;
}

boolean isPrivateKeyProvided() {
return (getPrivateKey() != null
|| getPrivateKeyFile() != null
|| getPrivateKeyBase64() != null);
}

public String getApplication() {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/snowflake/client/core/SFLoginOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class SFLoginOutput {
int databaseMajorVersion,
int databaseMinorVersion,
int httpClientSocketTimeout,
int httpClientConnectionTimeout,
String sessionDatabase,
String sessionSchema,
String sessionRole,
Expand Down Expand Up @@ -111,6 +112,10 @@ Duration getHttpClientSocketTimeout() {
return httpClientSocketTimeout;
}

Duration getHttpClientConnectionTimeout() {
return httpClientSocketTimeout;
}

Map<String, Object> getCommonParams() {
return commonParams;
}
Expand Down
Loading

0 comments on commit ba32b46

Please sign in to comment.