Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Increase the timeout on CQL queries. (#4447)
Browse files Browse the repository at this point in the history
  • Loading branch information
OStevan authored and jkozlowski committed Nov 28, 2019
1 parent f206f18 commit 60e11fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.datastax.driver.core.ProtocolVersion;
import com.datastax.driver.core.QueryOptions;
import com.datastax.driver.core.RemoteEndpointAwareJdkSSLOptions;
import com.datastax.driver.core.SocketOptions;
import com.datastax.driver.core.ThreadingOptions;
import com.datastax.driver.core.policies.DefaultRetryPolicy;
import com.datastax.driver.core.policies.LatencyAwarePolicy;
Expand Down Expand Up @@ -94,6 +95,7 @@ public CqlClient visit(CassandraServersConfigs.CqlCapableConfig cqlCapableConfig
clusterBuilder = withPoolingOptions(clusterBuilder, config);
clusterBuilder = withQueryOptions(clusterBuilder, config);
clusterBuilder = withLoadBalancingPolicy(clusterBuilder, config, servers);
clusterBuilder = withSocketOptions(clusterBuilder, config);

return CqlClientImpl.create(
taggedMetricRegistry,
Expand All @@ -104,6 +106,11 @@ public CqlClient visit(CassandraServersConfigs.CqlCapableConfig cqlCapableConfig
});
}

private Cluster.Builder withSocketOptions(Cluster.Builder clusterBuilder, CassandraKeyValueServiceConfig config) {
return clusterBuilder.withSocketOptions(
new SocketOptions().setReadTimeoutMillis(config.socketQueryTimeoutMillis()));
}

private static Cluster.Builder withSslOptions(Cluster.Builder builder, CassandraKeyValueServiceConfig config) {
if (!config.usingSsl()) {
return builder;
Expand Down
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-4447.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: improvement
improvement:
description: Set the timeout on CQL queries from the default 12 seconds to the `socketQueryTimeoutMillis`
specified in `CasssandraKeyValueServiceConfig`.
links:
- https://github.com/palantir/atlasdb/pull/4447

0 comments on commit 60e11fc

Please sign in to comment.