-
Notifications
You must be signed in to change notification settings - Fork 888
JAVA-2841: Raise timeouts during connection initialization #1480
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
Conversation
@olim7t knows better than me but afaik |
Actually |
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.
Don't forget the changelog entry.
nit: could you follow the project's branch naming convention for future PRs? java2841
@@ -255,7 +255,7 @@ protected static void fillWithDriverDefaults(OptionsMap map) { | |||
map.put(TypedDriverOption.LOAD_BALANCING_POLICY_SLOW_AVOIDANCE, true); | |||
map.put(TypedDriverOption.SESSION_LEAK_THRESHOLD, 4); | |||
map.put(TypedDriverOption.CONNECTION_CONNECT_TIMEOUT, Duration.ofSeconds(5)); | |||
map.put(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT, Duration.ofMillis(500)); | |||
map.put(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT, Duration.ofSeconds(5)); |
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.
reference.conf
uses HOCON substitutions to define a few other options in terms of this one. You need to update them too: CONNECTION_SET_KEYSPACE_TIMEOUT
, HEARTBEAT_TIMEOUT
, CONTROL_CONNECTION_TIMEOUT
and REPREPARE_TIMEOUT
.
In fact we should probably extract a variable:
Duration initQueryTimeout = Duration.ofSeconds(5);
map.put(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT, initQueryTimeout);
map.put(TypedDriverOption.CONNECTION_SET_KEYSPACE_TIMEOUT, initQueryTimeout);
...
Can you also do a pass to handle all other substitutions the same way, and commit that separately?
MapBasedDriverConfigLoaderTest.should_fill_default_profile_like_reference_file
will let you know if everything is in sync.
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.
done, what do you mean in a separate commit? Do you want to have two commits in the 4.x
after this branch will be merged?
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.
Yes, because the refactoring to handle other substitutions by extracting a local variable is unrelated to this PR.
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.
looks good, but as Olivier suggested, please do a pass to extract local variables for similar cases of hocon references in OptionsMap
.
It is already done in: |
No, I believe he was asking to apply the same refactoring to other cases of hocon references found in reference.conf. |
I've tested the new timeout by connecting to Astra cluster that is in us-west from central Europe using this code:
with the previous timeout of 500 milliseconds, it was constantly failing to connect.
For the new timeout of 5 seconds, it has successfully connected 100 times.
I don't see a clear reason to increase
connect-timeout
timeout as well - @adutra can you elaborate more on that suggestion?