Skip to content

Commit

Permalink
Merge pull request #194 from dkropachev/dk/remove-hosts-lock
Browse files Browse the repository at this point in the history
Remove unnecessary cowHostList lock
  • Loading branch information
sylwiaszunejko authored Jun 20, 2024
2 parents 0fa23fe + 83f6f42 commit fc7ab62
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fc7ab62

Please sign in to comment.