Skip to content

Commit 60e6696

Browse files
haaawkadutra
authored andcommitted
Avoid full cluster scans in Connection.checkClusterName (#1195)
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 <[email protected]>
1 parent 3cb45e8 commit 60e6696

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

driver-core/src/main/java/com/datastax/driver/core/Connection.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,9 @@ private ListenableFuture<Void> checkClusterName(
382382

383383
DefaultResultSetFuture clusterNameFuture =
384384
new DefaultResultSetFuture(
385-
null, protocolVersion, new Requests.Query("select cluster_name from system.local"));
385+
null,
386+
protocolVersion,
387+
new Requests.Query("select cluster_name from system.local where key = 'local'"));
386388
try {
387389
write(clusterNameFuture);
388390
return GuavaCompatibility.INSTANCE.transformAsync(

0 commit comments

Comments
 (0)