add lock on cluster.OwnsShard

This commit is contained in:
Matt Jaffee 2019-03-15 15:41:01 -05:00
parent 97ba8771bc
commit 33b54c68d5
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -851,6 +851,8 @@ func (c *cluster) shardNodes(index string, shard uint64) []*Node {
// ownsShard returns true if a host owns a fragment.
func (c *cluster) ownsShard(nodeID string, index string, shard uint64) bool {
c.mu.RLock()
defer c.mu.RUnlock()
return Nodes(c.shardNodes(index, shard)).ContainsID(nodeID)
}