-
Notifications
You must be signed in to change notification settings - Fork 188
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
connection retry refactor, add defaults with exponential backoff #207
Conversation
…connection from core
@@ -59,8 +59,8 @@ class SnowflakeCredentials(Credentials): | |||
proxy_host: Optional[str] = None | |||
proxy_port: Optional[int] = None | |||
protocol: Optional[str] = None | |||
connect_retries: int = 0 | |||
connect_timeout: int = 10 | |||
connect_retries: int = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Also discussed: using connect_retries
as the standard name everywhere (including Postgres/Redshift)
elif creds.retry_on_database_errors: | ||
retryable_exceptions = [snowflake.connector.errors.DatabaseError] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO let's use retry_on_database_errors: True
as our default. Users can optionally turn if off, or they can opt into all errors via retry_all
.
(@nathaniel-may may also be inspired to dig further into Snowflake docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found more sensible defaults by looking at the connector source.
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-core contributing guide, and the dbt-snowflake contriubuting guide. |
Hey @nathaniel-may whilst you folks are working on this one... does this sync up the We recently put in a default of This config for Snowflake's behaviour is:
As opposed to Redshift/PG's:
Footnotes |
Hey @jeremyyeo! This is part of a larger effort to keep timeout config behavior to roughly the same standard: The goal:
Exceptions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Excited to get this merged. Sorry for the delay with final review
# these two options are for backwards compatibility | ||
if creds.retry_all: | ||
retryable_exceptions = [Error] | ||
elif creds.retry_on_database_errors: | ||
retryable_exceptions.insert(0, DatabaseError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@nathaniel-may can we merge this in for the end of the sprint and call it done? |
resolves #205
retry_connection
from core.connect_retries
andconnect_timeout
are not specified: 1 retry after 1sconnect_retries
is specified butconnect_timeout
is not, it will use exponential backoffThis is a non-trivial change so I'll wait for sign off from @jtcohen6 before bothering to add the tests.
TODO
add similar tests from postgres PR<- those are testing the library function in core so we're covered here too.