From 83f6f4222b583c4ef2e20b4cae6485e904eadd62 Mon Sep 17 00:00:00 2001 From: Dmitry Kropachev Date: Wed, 19 Jun 2024 22:23:44 -0400 Subject: [PATCH] Remove unnecessary cowHostList lock --- policies.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/policies.go b/policies.go index af1f3bd89..73cbbc4ad 100644 --- a/policies.go +++ b/policies.go @@ -660,16 +660,14 @@ func (t *tokenAwareHostPolicy) Pick(qry ExecutableQuery) NextHost { tablet := findTabletForToken(tablets, token, l, r) replicas = []*HostInfo{} + hosts := t.hosts.get() for _, replica := range tablet.Replicas() { - t.hosts.mu.Lock() - hosts := t.hosts.get() for _, host := range hosts { if host.hostId == replica.hostId.String() { replicas = append(replicas, host) break } } - t.hosts.mu.Unlock() } } else { ht := meta.replicas[qry.Keyspace()].replicasFor(token)