Skip to content

Commit 3139892

Browse files
authored
cqlping: perform a query and not a scan (#4330)
Very similar to changes we've recently made in the drivers (see scylladb/java-driver#282 and scylladb/python-driver#418 , the query to system.local should be with the WHERE close to prevent a scan and just issue a local query. Fixes: #4329 Signed-off-by: Yaniv Kaul <[email protected]>
1 parent 8a90bef commit 3139892

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: docs/source/health-check.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ CQL query health check
141141

142142
You may specify CQL ``username`` and ``password`` flags when adding cluster to Scylla Manager using :ref:`sctool cluster add <cluster-add>` command.
143143
It's also possible to add or change that using :ref:`sctool cluster update <cluster-update>` command.
144-
Once Scylla Manager has CQL credential to the cluster, when performing a health check, it would try to connect to each node and execute ``SELECT now() FROM system.local`` query.
144+
Once Scylla Manager has CQL credential to the cluster, when performing a health check, it would try to connect to each node and execute ``SELECT now() FROM system.local WHERE key='local'`` query.
145145

146146

147147
.. _scylla-alternator-health-check:

Diff for: pkg/ping/cqlping/cqlping.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var cqlUnauthorisedMessage = []string{
9898
"Username and/or password are incorrect",
9999
}
100100

101-
// QueryPing executes "SELECT now() FROM system.local" on a single host.
101+
// QueryPing executes "SELECT now() FROM system.local WHERE key='local'" on a single host.
102102
// It returns rtt and error.
103103
func QueryPing(_ context.Context, config Config, username, password string) (rtt time.Duration, err error) {
104104
host, port, err := net.SplitHostPort(config.Addr)
@@ -169,7 +169,7 @@ func QueryPing(_ context.Context, config Config, username, password string) (rtt
169169
defer e.Close()
170170

171171
var date []byte
172-
iter := e.Iter("SELECT now() FROM system.local")
172+
iter := e.Iter("SELECT now() FROM system.local WHERE key='local'")
173173
iter.Scan(&date)
174174
return 0, iter.Close()
175175
}

0 commit comments

Comments
 (0)