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

Transport: cluster, local query does not work in benchmark. #223

Open
Choraden opened this issue Apr 27, 2022 · 3 comments
Open

Transport: cluster, local query does not work in benchmark. #223

Choraden opened this issue Apr 27, 2022 · 3 comments
Labels
bug Something isn't working transport

Comments

@Choraden
Copy link
Contributor

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:
Screenshot 2022-04-27 at 22 57 06

This is Scylla Cloud 3 Nodes:
Screenshot 2022-04-27 at 22 49 22

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?

@Choraden Choraden added bug Something isn't working transport labels Apr 27, 2022
@Michal-Leszczynski
Copy link
Collaborator

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?

@Choraden
Copy link
Contributor Author

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 hosts instead of the one obtained from system.local query?

@mmatczuk
Copy link
Contributor

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))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working transport
Projects
None yet
Development

No branches or pull requests

3 participants