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

Improve warning when initial connection is to host with rpc_address of 0.0.0.0 #113

Open
absurdfarce opened this issue Jan 23, 2023 · 1 comment

Comments

@absurdfarce
Copy link
Collaborator

This case leads to the following error message:

{"level":"error","ts":1674158444.9508557,"caller":"proxycore/cluster.go:357","msg":"unable to create new endpoint","error":"ignoring host because its `peer` is not set or is invalid","stacktrace":
"github.com/datastax/cql-proxy/proxycore.(*Cluster).addHosts\n\t/go/src/cql-proxy/proxycore/cluster.go:357
github.com/datastax/cql-proxy/proxycore.(*Cluster).queryHosts\n\t/go/src/cql-proxy/proxycore/cluster.go:300
github.com/datastax/cql-proxy/proxycore.(*Cluster).connect\n\t/go/src/cql-proxy/proxycore/cluster.go:223
github.com/datatax/cql-proxy/proxycore.ConnectCluster\n\t/go/src/cql-proxy/proxycore/cluster.go:163
github.com/datastax/cql-proxy/proxy.(*Proxy).Connect\n\t/go/src/cql-proxy/proxy/proxy.go:167
github.com/datastax/cql-proxy/proxy.(*runConfig).listenAndServe\n\t/go/src/cql-proxy/proxy/run.go:274
github.com/datastax/cql-proxy/proxy.Run\n\t/go/src/cql-proxy/proxy/run.go:195
main.main\n\t/go/src/cql-proxy/proxy.go:29
runtime.main\n\t/usr/local/go/src/runtime/proc.go:225"}                                                                          
panic: runtime error: index out of range [0] with length 0

Relevant code is NewEndpoint. This code starts with "rpc_address" and falls back to "peer" if that's set to 0.0.0.0. This doesn't work for system.local, though, where "peer" is not a defined column. Thus we wind up with the error message above which doesn't really communicate what's going on.

It would be nice if we could provide a more informative error to the user, at least something indicating that 0.0.0.0 rpc_addresses will introduce this behaviour.

@ikehara
Copy link
Contributor

ikehara commented Jul 10, 2024

Some of our Cassandra clusters have "rpc_address" column with an "unspecified" address of 0.0.0.0 in their system.local table. I would be glad if we could use cql-proxy with those clusters.

I found that the ZDM proxy seems to use broadcast_address or listen_address if rpc_address is 0.0.0.0.

https://github.com/datastax/zdm-proxy/blob/main/proxy/pkg/zdmproxy/host.go#L188

Is it possible to use the same logic in cql-proxy?

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

No branches or pull requests

2 participants