Skip to content

Commit b0c2c2a

Browse files
author
Eugene Ma
committed
fix ownUser
1 parent d8a21d5 commit b0c2c2a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

pkg/compactor/compactor.go

+14-3
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,23 @@ func (c *Compactor) ownUser(userID string) (bool, error) {
786786
return false, nil
787787
}
788788

789-
// Always owned if sharding is disabled or if using shuffle-sharding as shard ownership
790-
// is determined by the shuffle sharding grouper.
791-
if !c.compactorCfg.ShardingEnabled || c.compactorCfg.ShardingStrategy == util.ShardingStrategyShuffle {
789+
// Always owned if sharding is disabled.
790+
if !c.compactorCfg.ShardingEnabled {
792791
return true, nil
793792
}
794793

794+
// If using shuffle-sharding as shard ownership
795+
// is determined by the shuffle sharding grouper.
796+
if c.compactorCfg.ShardingStrategy == util.ShardingStrategyShuffle {
797+
subRing := c.ring.ShuffleShard(userID, c.limits.CompactorTenantShardSize(userID))
798+
799+
rs, err := subRing.GetAllHealthy(RingOp)
800+
if err != nil {
801+
return false, err
802+
}
803+
804+
return rs.Includes(c.ringLifecycler.Addr), nil
805+
}
795806
// Hash the user ID.
796807
hasher := fnv.New32a()
797808
_, _ = hasher.Write([]byte(userID))

0 commit comments

Comments
 (0)