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

Fix cowHostList can't have hosts with same ConnectAddress #185

Merged

Conversation

dkropachev
Copy link
Collaborator

@dkropachev dkropachev commented Jun 2, 2024

Addresses issue from gocql/gocql

Reopening of a #182

Problem

cowHostList uses HostInfo.Equal to confirm host uniqueness, which relies on ConnectAddress.Equal.
As result cowHostList does not allow to have different hosts with same ConnectAddress.

It breaks cases like accessing cluster via tcp or ssl proxy

host_source.go Outdated
h.mu.Lock()
defer h.mu.Unlock()
addr, _ := h.connectAddressLocked()
return net.JoinHostPort(addr.String(), strconv.Itoa(h.port))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These formatting changes are not related to this PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but it is definitely formatting issues, here, for example, it had spaces instead of tabs, is there a way to get these type of changes in ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate PR I guess

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

policies_test.go Outdated
"token 08 shuffling not configured": {hosts: []*HostInfo{
{hostId: "0", connectAddress: net.IPv4(10, 0, 0, 1), tokens: []string{"00", "10", "20"}},
{hostId: "1", connectAddress: net.IPv4(10, 0, 0, 3), tokens: []string{"25", "35", "45"}},
{hostId: "2", connectAddress: net.IPv4(10, 0, 0, 2), tokens: []string{"00", "10", "20"}},
{hostId: "3", connectAddress: net.IPv4(10, 0, 0, 4), tokens: []string{"25", "35", "45"}},
{hostId: "4", connectAddress: net.IPv4(10, 0, 0, 3), tokens: []string{"50", "60", "70"}},
{hostId: "5", connectAddress: net.IPv4(10, 0, 0, 4), tokens: []string{"50", "60", "70"}},
}, routingKey: "8", lwt: true, shuffle: false, want: []string{"0", "2", "3", "1"}},
}, routingKey: "8", lwt: true, shuffle: true, want: []string{"0", "2", "3", "4", "5", "1"}},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you changing shuffling in this example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my fault, changed it back

@dkropachev
Copy link
Collaborator Author

@sylwiaszunejko , I can't make pipeline to pass, starting container is failing, it has nothing to do with this PR

@dkropachev dkropachev force-pushed the fix-hostinto-uniqueness-logic branch from 4736a31 to 1cb65c3 Compare June 4, 2024 14:35
@sylwiaszunejko
Copy link
Collaborator

@dkropachev please rebase to master and the pipeline should pass then

cowHostList uses HostInfo.Equal to confirm host uniqueness,
which relies on `ConnectAddress.Equal`, which does not allow to have
different hosts with same `ConnectAddress`
@dkropachev dkropachev force-pushed the fix-hostinto-uniqueness-logic branch from 1cb65c3 to 3642984 Compare June 5, 2024 15:16
@sylwiaszunejko sylwiaszunejko merged commit f6911e4 into scylladb:master Jun 6, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants