Bläddra i källkod

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 5 år sedan
förälder
incheckning
313efb83f1
1 ändrade filer med 3 tillägg och 2 borttagningar
  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 (