Skip to content

Commit

Permalink
Avoid full cluster scans in Connection.checkClusterName (#1195)
Browse files Browse the repository at this point in the history
Select without a partition key results in full cluster
scan that can hurt the performance of the cluster.
There is an easy solution to the problem by just
using a 'local' partition key for the query.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
  • Loading branch information
haaawk authored and Alexandre Dutra committed May 20, 2019
1 parent 2cd9213 commit 85f2ced
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ private ListenableFuture<Void> checkClusterName(

DefaultResultSetFuture clusterNameFuture =
new DefaultResultSetFuture(
null, protocolVersion, new Requests.Query("select cluster_name from system.local"));
null,
protocolVersion,
new Requests.Query("select cluster_name from system.local where key = 'local'"));
try {
write(clusterNameFuture);
return GuavaCompatibility.INSTANCE.transformAsync(
Expand Down

0 comments on commit 85f2ced

Please sign in to comment.