joao-r-reis commented on code in PR #1948:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1948#discussion_r3280918366
##########
topology.go:
##########
@@ -381,14 +381,20 @@ func (n *networkTopology) replicaMap(tokenRing
*tokenRing) tokenRingReplicas {
}
dcsWithReplicas := 0
- for _, dc := range n.dcs {
- if dc > 0 {
+ for dc, rf := range n.dcs {
+ // We should count only DCs that driver is aware of and have a
replication factor > 0
+ if _, knownDc := dcRacks[dc]; knownDc && rf > 0 {
dcsWithReplicas++
}
}
if dcsWithReplicas == len(dcRacks) && len(replicaRing) != len(tokens) {
- panic(fmt.Sprintf("token map different size to token ring: got
%d expected %d", len(replicaRing), len(tokens)))
+ // Fallback to empty replica map if we have all the DCs with
replicas but no replicas in the ring.
+ logger.Warning("Not enough replicas in the ring for the
strategy key. Falling back to empty replica map.",
Review Comment:
as we discussed offline it looks like this condition will only be hit in
some kind of corrupted state or something so we don't have to worry about it
being annoying
--
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]