jameshartig commented on code in PR #1886:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1886#discussion_r2148948862
##########
host_source.go:
##########
@@ -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()
Review Comment:
I think this needs to instead look at `localHost` instead because I don't
think the peers table contains partitioner information.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]