Explorar o código

Fix token aware host policy. (#1400)

With ShuffleReplicas enabled, we were shuffling an empty list of
replicas and not doing any token aware routing.
Muir Manders %!s(int64=5) %!d(string=hai) anos
pai
achega
313efb83f1
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      policies.go

+ 3 - 2
policies.go

@@ -600,10 +600,11 @@ func (t *tokenAwareHostPolicy) Pick(qry ExecutableQuery) NextHost {
 	if ht == nil {
 		host, _ := meta.tokenRing.GetHostForToken(token)
 		replicas = []*HostInfo{host}
-	} else if t.shuffleReplicas {
-		replicas = shuffleHosts(replicas)
 	} else {
 		replicas = ht.hosts
+		if t.shuffleReplicas {
+			replicas = shuffleHosts(replicas)
+		}
 	}
 
 	var (