Skip to content

Commit

Permalink
fix merge conflicts - apply master changes in pom, use case insensiti…
Browse files Browse the repository at this point in the history
…ve map for user metadata
  • Loading branch information
sfc-gh-mkubik committed Oct 28, 2024
2 parents 8656d34 + 83e5849 commit f4ae228
Show file tree
Hide file tree
Showing 68 changed files with 1,835 additions and 1,147 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ In order to accurately debug the issue this information is required. Thanks!

https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

7. What is your Snowflake account identifier, if any? (Optional)
Before sharing any information, please be sure to review the log and remove any sensitive
information.
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ otherwise continue here.
## How would this improve `snowflake-jdbc`?

## References, Other Background

## What is your Snowflake account identifier, if any?

4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
**JDBC Driver 3.19.1**

- \||Please Refer to Release Notes at https://docs.snowflake.com/en/release-notes/clients-drivers/jdbc

**JDBC Driver 3.19.0**

- \||Please Refer to Release Notes at https://docs.snowflake.com/en/release-notes/clients-drivers/jdbc
Expand Down
22 changes: 5 additions & 17 deletions FIPS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,17 @@
<parent>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-parent</artifactId>
<version>3.19.0</version>
<version>3.19.2-SNAPSHOT</version>
<relativePath>../parent-pom.xml</relativePath>
</parent>

<artifactId>snowflake-jdbc-fips</artifactId>
<version>3.19.0</version>
<version>3.19.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>snowflake-jdbc-fips</name>
<url>http://maven.apache.org</url>

<repositories>
<repository>
<id>Central</id>
<name>Internal Central Repo2</name>
<layout>default</layout>
<url>https://nexus.int.snowflakecomputing.com/repository/maven-central/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
Expand Down Expand Up @@ -608,15 +596,15 @@
<unzip dest="${project.build.directory}/relocate" src="${project.build.directory}/${project.build.finalName}.jar"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/11/${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}"/>
<!-- 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/11/${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
4 changes: 2 additions & 2 deletions FIPS/public_pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</scm>

<properties>
<bouncycastle.bcfips.version>1.0.2.4</bouncycastle.bcfips.version>
<bouncycastle.bcpkixfips.version>1.0.5</bouncycastle.bcpkixfips.version>
<bouncycastle.bcfips.version>1.0.2.5</bouncycastle.bcfips.version>
<bouncycastle.bcpkixfips.version>1.0.7</bouncycastle.bcpkixfips.version>
<jna.version>5.13.0</jna.version>
</properties>

Expand Down
4 changes: 2 additions & 2 deletions FIPS/scripts/check_content.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash -e

# scripts used to check if all dependency is shaded into snowflake internal path
# scripts used to check if all dependencies are shaded into snowflake internal path

set -o pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

if jar tvf $DIR/../target/snowflake-jdbc-fips.jar | awk '{print $8}' | grep -v -E "^(net|com)/snowflake" | grep -v -E "(com|net)/\$" | grep -v -E "^META-INF" | grep -v -E "^mozilla" | grep -v -E "^com/sun/jna" | grep -v com/sun/ | grep -v mime.types; then
if jar tvf $DIR/../target/snowflake-jdbc-fips.jar | awk '{print $8}' | grep -v -E "^(net|com)/snowflake" | grep -v -E "(com|net)/\$" | grep -v -E "^META-INF" | grep -v -E "^mozilla" | grep -v -E "^com/sun/jna" | grep -v com/sun/ | grep -v mime.types | grep -v -E "^com/github/" | grep -v -E "^aix/" | grep -v -E "^darwin/" | grep -v -E "^freebsd/" | grep -v -E "^linux/" | grep -v -E "^win/"; then
echo "[ERROR] JDBC jar includes class not under the snowflake namespace"
exit 1
fi
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ timestamps {
}.collectEntries { jobDefinition ->
return [(jobDefinition.runName): { build job: jobDefinition.jobToRun, parameters: jobDefinition.params }]
}

jobDefinitions.put('JDBC-AIX-Unit', { build job: 'JDBC-AIX-UnitTests', parameters: [ string(name: 'BRANCH', value: scmInfo.GIT_BRANCH ) ] } )
stage('Test') {
parallel (jobDefinitions)
}
Expand Down
6 changes: 3 additions & 3 deletions ci/scripts/check_content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ set -o pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -v -E "^(net|com)/snowflake" | grep -v -E "(com|net)/\$" | grep -v -E "^META-INF" | grep -v -E "^mozilla" | grep -v -E "^com/sun/jna" | grep -v com/sun/ | grep -v mime.types; then
if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -v -E "^(net|com)/snowflake" | grep -v -E "(com|net)/\$" | grep -v -E "^META-INF" | grep -v -E "^mozilla" | grep -v -E "^com/sun/jna" | grep -v com/sun/ | grep -v mime.types | grep -v -E "^com/github/" | grep -v -E "^aix/" | grep -v -E "^darwin/" | grep -v -E "^freebsd/" | grep -v -E "^linux/" | grep -v -E "^win/"; then
echo "[ERROR] JDBC jar includes class not under the snowflake namespace"
exit 1
fi

if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -E "^META-INF/versions/.*.class" | grep -v -E "^META-INF/versions/.*/(net|com)/snowflake"; then
echo "[ERROR] JDBC jar includes multi release classes not under the snowflake namespace"
if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -E "^META-INF/versions/.*.class" | grep -v -E "^META-INF/versions/.*/(net|com)/snowflake" | grep -v -E "^META-INF/versions/.*/com/github" | grep -v -E "^aix/" | grep -v -E "^darwin/" | grep -v -E "^freebsd/" | grep -v -E "^linux/" | grep -v -E "^win/"; then
echo "[ERROR] JDBC jar includes multi-release classes not under the snowflake namespace"
exit 1
fi
2 changes: 1 addition & 1 deletion dependencies/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Arrow dependencies are built from internal branch `upgradeto17.0.0`. This build was applied the AIX fix.
Arrow dependencies are built from internal branch `upgradeTo17.0.0-v2`. This build was applied the AIX fix and the customer logger instead of slf4j logger.

Binary file modified dependencies/arrow-format-17.0.0.jar
Binary file not shown.
Binary file modified dependencies/arrow-memory-core-17.0.0.jar
Binary file not shown.
Binary file modified dependencies/arrow-memory-netty-buffer-patch-17.0.0.jar
Binary file not shown.
Binary file modified dependencies/arrow-memory-unsafe-17.0.0.jar
Binary file not shown.
Binary file modified dependencies/arrow-vector-17.0.0.jar
Binary file not shown.
15 changes: 10 additions & 5 deletions linkage-checker-exclusion-rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
<Source><Package name="org.apache.commons.compress.compressors"/></Source>
<Reason>Optional</Reason>
</LinkageError>
<LinkageError>
<Target><Package name="com.github.luben.zstd"/></Target>
<Source><Package name="org.apache.commons.compress.compressors"/></Source>
<Reason>Optional</Reason>
</LinkageError>
<LinkageError>
<Target><Package name="com.google.appengine.api.urlfetch"/></Target>
<Source><Package name="com.google.api.client.extensions.appengine"/></Source>
Expand All @@ -44,6 +39,16 @@
<Source><Package name="org.bouncycastle.pkix"/></Source>
<Reason>?</Reason>
</LinkageError>
<LinkageError>
<Target><Package name="java.nio"/></Target>
<Source><Package name="org.bouncycastle.jcajce.provider.symmetric.util"/></Source>
<Reason>?</Reason>
</LinkageError>
<LinkageError>
<Target><Package name="java.nio"/></Target>
<Source><Package name="org.bouncycastle.pqc.legacy.crypto.ntru"/></Source>
<Reason>?</Reason>
</LinkageError>
<!--
<LinkageError>
<Target><Package name=""/></Target>
Expand Down
26 changes: 21 additions & 5 deletions parent-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-parent</artifactId>
<version>3.19.0</version>
<version>3.19.2-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand All @@ -19,15 +19,16 @@
<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>
<zstd-jni.version>1.5.6-5</zstd-jni.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.655</awssdk.version>
<azure.storage.blob.version>12.26.1</azure.storage.blob.version>
<bouncycastle.version>1.74</bouncycastle.version>
<bouncycastle.bcfips.version>1.0.2.4</bouncycastle.bcfips.version>
<bouncycastle.bcpkixfips.version>1.0.5</bouncycastle.bcpkixfips.version>
<bouncycastle.version>1.78.1</bouncycastle.version>
<bouncycastle.bcfips.version>1.0.2.5</bouncycastle.bcfips.version>
<bouncycastle.bcpkixfips.version>1.0.7</bouncycastle.bcpkixfips.version>
<bytebuddy.version>1.14.17</bytebuddy.version>
<classworlds.version>1.1</classworlds.version>
<checkerframework.version>3.33.0</checkerframework.version>
Expand All @@ -49,7 +50,7 @@
<google.guava.version>32.1.1-jre</google.guava.version>
<google.http.client.version>1.43.3</google.http.client.version>
<google.jsr305.version>3.0.2</google.jsr305.version>
<google.protobuf.java.version>3.23.3</google.protobuf.java.version>
<google.protobuf.java.version>3.25.5</google.protobuf.java.version>
<grpc.version>1.60.0</grpc.version>
<hamcrest.version>2.2</hamcrest.version>
<hikaricp.version>2.4.3</hikaricp.version>
Expand Down Expand Up @@ -327,6 +328,11 @@
<artifactId>httpcore</artifactId>
<version>${apache.httpcore.version}</version>
</dependency>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>${zstd-jni.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
Expand Down Expand Up @@ -448,6 +454,12 @@
<artifactId>bcprov-jdk18on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<!-- for non-FIPS JAR -->
<groupId>org.bouncycastle</groupId>
<artifactId>bcutil-jdk18on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<!-- for FIPS JAR -->
<groupId>org.bouncycastle</groupId>
Expand Down Expand Up @@ -644,6 +656,10 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
Expand Down
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-parent</artifactId>
<version>3.19.0</version>
<version>3.19.2-SNAPSHOT</version>
<relativePath>./parent-pom.xml</relativePath>
</parent>

<!-- Maven complains about using property here, but it makes install and deploy process easier to override final package names and localization -->
<artifactId>${artifactId}</artifactId>
<version>3.19.0</version>
<version>3.19.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>${artifactId}</name>
Expand All @@ -36,6 +36,10 @@
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcutil-jdk18on</artifactId>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -1031,6 +1035,7 @@
<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}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/21/org" todir="${project.build.directory}/relocate/META-INF/versions/21/${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}"/>
Expand Down Expand Up @@ -1105,7 +1110,7 @@
<!--
Downloading
1. japicmp
2. maven-dependency-lugin analyst
2. maven-dependency-plugin analyst
in jenkins node would cause http connection failure. Temporarily disable them.
-->
<plugin>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/net/snowflake/client/core/CancellationReason.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved.
*/
package net.snowflake.client.core;

@SnowflakeJdbcInternalApi
public enum CancellationReason {
UNKNOWN,
CLIENT_REQUESTED,
TIMEOUT
}
14 changes: 14 additions & 0 deletions src/main/java/net/snowflake/client/core/SFBaseStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,23 @@ public abstract SFBaseResultSet asyncExecute(
*
* @throws SFException if the statement is already closed.
* @throws SQLException if there are server-side errors from trying to abort.
* @deprecated use {@link #cancel(CancellationReason)} instead
*/
@Deprecated
public abstract void cancel() throws SFException, SQLException;

/**
* Aborts the statement.
*
* @param cancellationReason reason for the cancellation
* @throws SFException if the statement is already closed.
* @throws SQLException if there are server-side errors from trying to abort.
*/
@SnowflakeJdbcInternalApi
public void cancel(CancellationReason cancellationReason) throws SFException, SQLException {
cancel(); // default cancel is called to keep interface backward compatibility
}

/**
* Sets a property within session properties, i.e., if the sql is using set-sf-property
*
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/snowflake/client/core/SFLoginOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class SFLoginOutput {
private int databaseMajorVersion;
private int databaseMinorVersion;
private Duration httpClientSocketTimeout;
private Duration httpClientConnectionTimeout;
private String sessionDatabase;
private String sessionSchema;
private String sessionRole;
Expand Down Expand Up @@ -53,6 +54,7 @@ public class SFLoginOutput {
this.databaseMajorVersion = databaseMajorVersion;
this.databaseMinorVersion = databaseMinorVersion;
this.httpClientSocketTimeout = Duration.ofMillis(httpClientSocketTimeout);
this.httpClientConnectionTimeout = Duration.ofMillis(httpClientConnectionTimeout);
this.sessionDatabase = sessionDatabase;
this.sessionSchema = sessionSchema;
this.sessionRole = sessionRole;
Expand Down Expand Up @@ -113,7 +115,7 @@ Duration getHttpClientSocketTimeout() {
}

Duration getHttpClientConnectionTimeout() {
return httpClientSocketTimeout;
return httpClientConnectionTimeout;
}

Map<String, Object> getCommonParams() {
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/net/snowflake/client/core/SFStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ private TimeBombTask(SFStatement statement) {
@Override
public Void call() throws SQLException {
try {
statement.cancel();
statement.cancel(CancellationReason.TIMEOUT);
} catch (SFException ex) {
throw new SnowflakeSQLLoggedException(
session, ex.getSqlState(), ex.getVendorCode(), ex, ex.getParams());
Expand Down Expand Up @@ -711,10 +711,11 @@ private void reauthenticate() throws SFException, SnowflakeSQLException {
*
* @param sql sql statement
* @param mediaType media type
* @param cancellationReason reason for the cancellation
* @throws SnowflakeSQLException if failed to cancel the statement
* @throws SFException if statement is already closed
*/
private void cancelHelper(String sql, String mediaType)
private void cancelHelper(String sql, String mediaType, CancellationReason cancellationReason)
throws SnowflakeSQLException, SFException {
synchronized (this) {
if (isClosed) {
Expand All @@ -734,7 +735,7 @@ private void cancelHelper(String sql, String mediaType)
.setMaxRetries(session.getMaxHttpRetries())
.setHttpClientSettingsKey(session.getHttpClientKey());

StmtUtil.cancel(stmtInput);
StmtUtil.cancel(stmtInput, cancellationReason);

synchronized (this) {
/*
Expand Down Expand Up @@ -842,6 +843,12 @@ public void close() {
@Override
public void cancel() throws SFException, SQLException {
logger.trace("void cancel()", false);
cancel(CancellationReason.UNKNOWN);
}

@Override
public void cancel(CancellationReason cancellationReason) throws SFException, SQLException {
logger.trace("void cancel(CancellationReason)", false);

if (canceling.get()) {
logger.debug("Query is already cancelled", false);
Expand All @@ -866,7 +873,7 @@ public void cancel() throws SFException, SQLException {
}

// cancel the query on the server side if it has been issued
cancelHelper(this.sqlText, StmtUtil.SF_MEDIA_TYPE);
cancelHelper(this.sqlText, StmtUtil.SF_MEDIA_TYPE, cancellationReason);
}
}

Expand Down
Loading

0 comments on commit f4ae228

Please sign in to comment.