Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cowHostList uses outdated logic for host uniqueness #1757

Open
dkropachev opened this issue May 30, 2024 · 0 comments · May be fixed by #1758
Open

cowHostList uses outdated logic for host uniqueness #1757

dkropachev opened this issue May 30, 2024 · 0 comments · May be fixed by #1758

Comments

@dkropachev
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Cassandra are you using?

any

What version of Gocql are you using?

v1.6.0

What version of Go are you using?

1.22

What did you do?

My cluster is hidden behind proxy, all nodes are mapped to one address, but different ports.
For this purpose i have use custom AddressTranslator that maps broadcase_address of nodes nodes to host+port of the proxy.

It works great, but unfortunately if one node goes down I begin experiencing queries returning ErrNoConnections.
Source of the problem is the following, when nodes are being added to the roundRobinHostPolicy:
https://github.com/gocql/gocql/blob/6d279ed01c1069d14420584f3f7d5bc1794cf804/policies.go#L331-L333

It uses cowHostList.add to do the job, which does deduplication via HostInfo.Equal:
https://github.com/gocql/gocql/blob/6d279ed01c1069d14420584f3f7d5bc1794cf804/policies.go#L50-L60

Which relies on h.ConnectAddress().Equal(host.ConnectAddress()):
https://github.com/gocql/gocql/blob/6d279ed01c1069d14420584f3f7d5bc1794cf804/host_source.go#L135-L142

As result I end-up with only one node in the roundRobinHostPolicy.hosts pool and if this node is one that does not work, then I get ErrNoConnections after first retry.

What did you expect to see?

Everything works as supposed to

What did you see instead?

ErrNoConnections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant