scylla-go-driver
scylla-go-driver copied to clipboard
Transport: cluster, local query does not work in benchmark.
Driver considers system.peers and system.local as the same things in dial, but in fact these are different!
This is scylla in our repo:

This is Scylla Cloud 3 Nodes:

Driver connects to first one via local address cause it's on the very same machine. However, driver cannot connect to remote scylla via hers local addresses, it needs to use rpc_addresses.
We need to somehow pick right addresses to given nodes. Eventually we can add both and one node will always be down, but I'm not sure how will it operate with host selection policy. @Michal-Leszczynski is node that is down still picked in token away policy, round robin, etc?
So basically the only thing that requires a change is that the node (to which we have connected with control connection) has to take the IP stored in known hosts instead of the one obtained from system.local query?
Maybe it would be better solution to always connect to known hosts, but refresh known host from time to time.
So basically the only thing that requires a change is that the node (to which we have connected with control connection) has to take the IP stored in
known hostsinstead of the one obtained fromsystem.localquery?
The addresses have precedence, please take a look at this code.
func validIpAddr(addr net.IP) bool {
return addr != nil && !addr.IsUnspecified()
}
func (h *HostInfo) connectAddressLocked() (net.IP, string) {
if validIpAddr(h.connectAddress) {
return h.connectAddress, "connect_address"
} else if validIpAddr(h.rpcAddress) {
return h.rpcAddress, "rpc_adress"
} else if validIpAddr(h.preferredIP) {
// where does perferred_ip get set?
return h.preferredIP, "preferred_ip"
} else if validIpAddr(h.broadcastAddress) {
return h.broadcastAddress, "broadcast_address"
} else if validIpAddr(h.peer) {
return h.peer, "peer"
}
return net.IPv4zero, "invalid"
}
// Returns the address that should be used to connect to the host.
// If you wish to override this, use an AddressTranslator or
// use a HostFilter to SetConnectAddress()
func (h *HostInfo) ConnectAddress() net.IP {
h.mu.RLock()
defer h.mu.RUnlock()
if addr, _ := h.connectAddressLocked(); validIpAddr(addr) {
return addr
}
panic(fmt.Sprintf("no valid connect address for host: %v. Is your cluster configured correctly?", h))
}