Skip to content

Commit

Permalink
better logic for when to shard wrt disabled lookback (#5303)
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-d authored Feb 2, 2022
1 parent 40e0519 commit a88ee16
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/querier/queryrange/querysharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@ func (splitter *shardSplitter) Do(ctx context.Context, r queryrangebase.Request)
return splitter.shardingware.Do(ctx, r)
}
cutoff := splitter.now().Add(-minShardingLookback)
// Only attempt to shard queries which are older than the sharding lookback (the period for which ingesters are also queried).
if !cutoff.After(util.TimeFromMillis(r.GetEnd())) {
return splitter.next.Do(ctx, r)
// Only attempt to shard queries which are older than the sharding lookback
// (the period for which ingesters are also queried) or when the lookback is disabled.
if minShardingLookback == 0 || util.TimeFromMillis(r.GetEnd()).Before(cutoff) {
return splitter.shardingware.Do(ctx, r)
}
return splitter.shardingware.Do(ctx, r)
return splitter.next.Do(ctx, r)
}

func hasShards(confs ShardingConfigs) bool {
Expand Down

0 comments on commit a88ee16

Please sign in to comment.