Skip to content

Snow 1915351 network problems retrying2 #2153

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

sfc-gh-pmotacki
Copy link
Collaborator

Overview

SNOW-XXXXX

Pre-review self checklist

  • PR branch is updated with all the changes from master branch
  • The code is correctly formatted (run mvn -P check-style validate)
  • New public API is not unnecessary exposed (run mvn verify and inspect target/japicmp/japicmp.html)
  • The pull request name is prefixed with SNOW-XXXX:
  • Code is in compliance with internal logging requirements

External contributors - please answer these questions before submitting a pull request. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Issue: #NNNN

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am modifying authorization mechanisms
    • I am adding new credentials
    • I am modifying OCSP code
    • I am adding a new dependency or upgrading an existing one
    • I am adding new public/protected component not marked with @SnowflakeJdbcInternalApi (note that public/protected methods/fields in classes marked with this annotation are already internal)
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

@sfc-gh-pmotacki sfc-gh-pmotacki force-pushed the SNOW-1915351-network-problems-retrying2 branch from 24000c9 to b1fd8aa Compare April 11, 2025 11:54
@sfc-gh-snowflakedb-snyk-sa
Copy link
Contributor

sfc-gh-snowflakedb-snyk-sa commented Apr 11, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@sfc-gh-pmotacki sfc-gh-pmotacki force-pushed the SNOW-1915351-network-problems-retrying2 branch 2 times, most recently from ede6e57 to e139120 Compare April 14, 2025 11:05
@sfc-gh-pmotacki sfc-gh-pmotacki force-pushed the SNOW-1915351-network-problems-retrying2 branch from ec3de52 to 5c86146 Compare April 23, 2025 06:51
@sfc-gh-pmotacki sfc-gh-pmotacki marked this pull request as ready for review April 23, 2025 06:52
@sfc-gh-pmotacki sfc-gh-pmotacki requested a review from a team as a code owner April 23, 2025 06:52
// when there are transient network/GS issues
private long startTimePerRequest;
// Used to indicate that this is a login/auth request and will be using the new retry strategy.
boolean isLoginRequest;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not make this private (perhaps even final), when we have public getters/setters?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, final, not because we have a setter.

}

static long getNewBackoffInMilli(
public static long getNewBackoffInMilli(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to expose this to the public? Without @SnowflakeJdbcInternalApi?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

* @throws net.snowflake.client.jdbc.SnowflakeSQLException Request timeout Exception or Illegal
* State Exception i.e. connection is already shutdown etc
*/
public static HttpResponseContextDto executeWitRetries(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal api annotation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -318,6 +318,10 @@ public static Connection getConnection(
properties.put("warehouse", params.get("warehouse"));
properties.put("ssl", params.get("ssl"));

// properties.put("useProxy", "true");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

importMappingFromResources(SCENARIOS_BASE_DIR + "/response503.json");
Properties props = new Properties();
props.setProperty("maxHttpRetries", "3");
// WireMock.setScenarioState("malformed_response_retry", "MALFORMED_RETRY_3");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


// max backoff in milli before we retry due to transient issues
// we double the backoff after each retry till we reach the max backoff
// private static final long maxBackoff= 16000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover?

@SnowflakeJdbcInternalApi
public class HttpExecutingContext {

// min backoff in milli before we retry due to transient issues
Copy link
Contributor

@sfc-gh-fpawlowski sfc-gh-fpawlowski May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other parts of the code you used ...Milliseconds suffix for values in milliseconds. Names without it meant values in seconds. Should we use such convention here as well and maybe include such explanation somewhere in comments?

@sfc-gh-pmotacki sfc-gh-pmotacki force-pushed the SNOW-1915351-network-problems-retrying2 branch from 338f1ae to b979ef1 Compare May 21, 2025 13:59
@sfc-gh-pmotacki sfc-gh-pmotacki force-pushed the SNOW-1915351-network-problems-retrying2 branch from b979ef1 to 8dd554c Compare May 21, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants