better logic for when to shard wrt disabled lookback (#5303)

pull/5307/head
Owen Diehl 3 years ago committed by GitHub
parent 40e05198f9
commit a88ee16534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      pkg/querier/queryrange/querysharding.go

@ -200,11 +200,12 @@ func (splitter *shardSplitter) Do(ctx context.Context, r queryrangebase.Request)
return splitter.shardingware.Do(ctx, r) return splitter.shardingware.Do(ctx, r)
} }
cutoff := splitter.now().Add(-minShardingLookback) 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). // Only attempt to shard queries which are older than the sharding lookback
if !cutoff.After(util.TimeFromMillis(r.GetEnd())) { // (the period for which ingesters are also queried) or when the lookback is disabled.
return splitter.next.Do(ctx, r) 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 { func hasShards(confs ShardingConfigs) bool {

Loading…
Cancel
Save