mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
fix data race which appears to be unrelated to previous changes
This commit is contained in:
parent
7304258967
commit
8b3e5b998a
2 changed files with 8 additions and 1 deletions
|
|
@ -836,6 +836,13 @@ func (c *cluster) partition(index string, shard uint64) int {
|
|||
return int(h.Sum64() % uint64(c.partitionN))
|
||||
}
|
||||
|
||||
// ShardNodes returns a list of nodes that own a fragment. Safe for concurrent use.
|
||||
func (c *cluster) ShardNodes(index string, shard uint64) []*Node {
|
||||
c.mu.RLock()
|
||||
defer c.mu.RUnlock()
|
||||
return c.shardNodes(index, shard)
|
||||
}
|
||||
|
||||
// shardNodes returns a list of nodes that own a fragment. unprotected
|
||||
func (c *cluster) shardNodes(index string, shard uint64) []*Node {
|
||||
return c.partitionNodes(c.partition(index, shard))
|
||||
|
|
|
|||
|
|
@ -2138,7 +2138,7 @@ func (e *executor) shardsByNode(nodes []*Node, index string, shards []uint64) (m
|
|||
|
||||
loop:
|
||||
for _, shard := range shards {
|
||||
for _, node := range e.Cluster.shardNodes(index, shard) {
|
||||
for _, node := range e.Cluster.ShardNodes(index, shard) {
|
||||
if Nodes(nodes).Contains(node) {
|
||||
m[node] = append(m[node], shard)
|
||||
continue loop
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue