Skip to content

Commit ccbf001

Browse files
committed
Compactor.ownUser now determines whether the user is owned by a compactor via ring, instead of returning true if shuffle-sharding is enabled
Signed-off-by: Roy Chiang <[email protected]>
1 parent fb15202 commit ccbf001

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

pkg/compactor/compactor.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,12 +818,23 @@ func (c *Compactor) ownUser(userID string) (bool, error) {
818818
return false, nil
819819
}
820820

821-
// Always owned if sharding is disabled or if using shuffle-sharding as shard ownership
822-
// is determined by the shuffle sharding grouper.
823-
if !c.compactorCfg.ShardingEnabled || c.compactorCfg.ShardingStrategy == util.ShardingStrategyShuffle {
821+
// Always owned if sharding is disabled
822+
if !c.compactorCfg.ShardingEnabled {
824823
return true, nil
825824
}
826825

826+
// If using shuffle-sharding, ownership is determined by the ring
827+
if c.compactorCfg.ShardingStrategy == util.ShardingStrategyShuffle {
828+
subRing := c.ring.ShuffleShard(userID, c.limits.CompactorTenantShardSize(userID))
829+
830+
rs, err := subRing.GetAllHealthy(RingOp)
831+
if err != nil {
832+
return false, err
833+
}
834+
835+
return rs.Includes(c.ringLifecycler.Addr), nil
836+
}
837+
827838
// Hash the user ID.
828839
hasher := fnv.New32a()
829840
_, _ = hasher.Write([]byte(userID))

0 commit comments

Comments
 (0)