Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion host_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,21 @@ func (r *ringDescriber) GetHosts() ([]*HostInfo, string, error) {
return r.prevHosts, r.prevPartitioner, err
}

hosts := append([]*HostInfo{localHost}, peerHosts...)
// if the same HostID exists in peerHosts, localHost needs to be excluded to work properly with Amazon Keyspaces (CASSGO-72, #1873)
var hasSameHostID bool
for _, h := range peerHosts {
if h.HostID() == localHost.HostID() {
hasSameHostID = true
}
}

var hosts []*HostInfo
if hasSameHostID {
hosts = peerHosts
} else {
hosts = append([]*HostInfo{localHost}, peerHosts...)
}

var partitioner string
if len(hosts) > 0 {
partitioner = hosts[0].Partitioner()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs to instead look at localHost instead because I don't think the peers table contains partitioner information.

Expand Down