Open vladzcloudius opened 1 year ago
To clarify the issue here. When we're using host:19042
as a connection string, the driver assumes that this port (19042) is a non-shard aware port - it stores it into the port field of HostInfo
: https://github.com/scylladb/gocql/blob/e38b2bcca0a61280272806d1e2bd2b23c9749773/control.go#L115
Later, this port can be used as a fallback option when shard-aware connection failed (https://github.com/scylladb/gocql/blob/e38b2bcca0a61280272806d1e2bd2b23c9749773/scylla.go#L658, and this addr
is built here: https://github.com/scylladb/gocql/blob/e38b2bcca0a61280272806d1e2bd2b23c9749773/scylla.go#L615 using this port
from HostInfo
).
As a result, we can get an infinite loop of connection->fallback->reconnection because of this logic - https://github.com/scylladb/gocql/blob/e38b2bcca0a61280272806d1e2bd2b23c9749773/scylla.go#L408 - which clearly assumes that addr
is either shard-aware address or a fallback. But when we used host:19042
as a connection string, both are equal.
What version of Scylla or Cassandra are you using?
2022.2.6
What version of Gocql are you using?
HEAD: e38b2bcca0a61280272806d1e2bd2b23c9749773
What version of Go are you using?
irrelevant
What did you do?
connected to the cluster providing it a connection string as
host:19042
assuming this is what I need to do when I want to use a scylla shard-aware-port.What did you expect to see?
World peace!
What did you see instead?
Not what I expected...
Description Scylla's GoCQL fork doesn't seem to have anywhere mentioned that a user is supposed to provide a not-shard-aware port in the connection string since this is the port that is going to be used as a fallback if a connection to a shard-aware-port (sent using the
SUPPORTED
protocol extension) fails.This is less than obvious! Please, document this properly.
Reported by: @isburmistrov