Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1437655 Fix for getQueryMetadata retry #1778

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/snowflake/client/core/SFSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private JsonNode getQueryMetadata(String queryID) throws SQLException {
HttpUtil.executeGeneralRequest(
get,
loginTimeout,
authTimeout,
0, // no authentication timeout for the request
(int) httpClientSocketTimeout.toMillis(),
maxHttpRetries,
getHttpClientKey());
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/snowflake/client/jdbc/RestRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ public static CloseableHttpResponse execute(
ErrorCode.NETWORK_ERROR.getMessageCode());
// rethrow the timeout exception
if (response == null && savedEx != null) {
logger.debug("Rethrow the timeout exception for: {}", savedEx.getMessage());
throw new SnowflakeSQLException(
savedEx,
ErrorCode.NETWORK_ERROR,
Expand All @@ -402,6 +403,7 @@ public static CloseableHttpResponse execute(
// If this was a request for an Okta one-time token that failed with a retry-able error,
// throw exception to renew the token before trying again.
if (String.valueOf(httpRequest.getURI()).contains("okta.com/api/v1/authn")) {
logger.debug("Exception to renew the Okta one-time token before trying again");
throw new SnowflakeSQLException(
ErrorCode.AUTHENTICATOR_REQUEST_TIMEOUT,
retryCount,
Expand All @@ -422,6 +424,7 @@ public static CloseableHttpResponse execute(
/* connect timeout not reached */
// check if this is a login-request
if (String.valueOf(httpRequest.getURI()).contains("login-request")) {
logger.debug("Authentication timeout for login request");
throw new SnowflakeSQLException(
ErrorCode.AUTHENTICATOR_REQUEST_TIMEOUT,
retryCount,
Expand Down Expand Up @@ -466,6 +469,7 @@ public static CloseableHttpResponse execute(
// increase the retry count and throw special exception to renew the token before retrying.
if (authTimeout > 0) {
if (elapsedMilliForTransientIssues >= authTimeoutInMilli) {
logger.debug("Authentication request timeout for: {}", requestInfoScrubbed);
throw new SnowflakeSQLException(
ErrorCode.AUTHENTICATOR_REQUEST_TIMEOUT,
retryCount,
Expand Down Expand Up @@ -547,6 +551,7 @@ public static CloseableHttpResponse execute(

// rethrow the timeout exception
if (response == null && savedEx != null) {
logger.debug("Rethrow (2) the timeout exception for: {}", savedEx.getMessage());
throw new SnowflakeSQLException(
savedEx,
ErrorCode.NETWORK_ERROR,
Expand Down
Loading