yomipq commented on issue #1873:
URL: 
https://github.com/apache/cassandra-gocql-driver/issues/1873#issuecomment-2780369266

   > Reading through refreshRing function I'd think that the aws keyspaces case 
would not be an issue because it starts with the local host as it is iterating 
through the slice and then when it reaches the peer host with the same host id 
it should update the IPs... Maybe there's some bug here.
   
   I might have found the cause. In the for-loop of hosts in `refreshRing` 
https://github.com/apache/cassandra-gocql-driver/blob/v1.7.0/host_source.go#L727-L756
 , it first processes the localhost, overwrites the IP address to 127.0.0.1 and 
removes the hostID from `prevHosts` . And then it processes the peer host with 
the same hostID, but the hostID no longer exists in `prevHosts`, resulting in 
the `ErrCannotFindHost` error.
   
   I think it would fix the issue to move `delete(prevHosts, h.HostID())` to 
after the for-loop. In other words, it first processes localhost, then the peer 
host, where it reverts IP address from local address to peer address, and 
finally delete the existing hostIDs from `prevHosts` after all hosts are 
processed.
   
   What do you think about this?


-- 
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: commits-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to