worryg0d commented on code in PR #1948:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1948#discussion_r3274462439


##########
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:
   It should not be really loudy if I understand things right - replica map 
computation only when there is a schema refresh or `AddHost` is called. 
   
   Schema refresh happens when there is a node / topology events incoming or 
control conn reconnection schedules it so that should not be that loud.
   
   



-- 
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]

Reply via email to