Describe the bug
results_cache_ttl and out_of_order_results_cache_ttl are both per-tenant limits.
If a tenant sets only results_cache_ttl and leaves out_of_order_results_cache_ttl
at its default of 0, cached results are split across two different TTLs:
- results outside the out-of-order time window →
results_cache_ttl ✅
- results inside the out-of-order time window → global cache backend TTL ❌
So overriding results_cache_ttl alone silently fails to apply to recent data, and
that data instead picks up an unrelated global default.
Expected behaviour
out_of_order_results_cache_ttl should fall back to results_cache_ttl first, and
only then to the global cache backend TTL:
out_of_order_results_cache_ttl → results_cache_ttl → global cache backend TTL
Where
getTTLForExtents in pkg/querier/tripperware/queryrange/results_cache.go returns the
out-of-order TTL unconditionally when extents overlap the out-of-order window, with no
fallback when it is 0.
Note the fallback has to be resolved per tenant before aggregating across tenants,
since SmallestPositiveNonZeroDurationPerTenant discards zeros — otherwise a federated
query loses the information about which tenant left the value unset.
Describe the bug
results_cache_ttlandout_of_order_results_cache_ttlare both per-tenant limits.If a tenant sets only
results_cache_ttland leavesout_of_order_results_cache_ttlat its default of
0, cached results are split across two different TTLs:results_cache_ttl✅So overriding
results_cache_ttlalone silently fails to apply to recent data, andthat data instead picks up an unrelated global default.
Expected behaviour
out_of_order_results_cache_ttlshould fall back toresults_cache_ttlfirst, andonly then to the global cache backend TTL:
out_of_order_results_cache_ttl → results_cache_ttl → global cache backend TTL
Where
getTTLForExtentsinpkg/querier/tripperware/queryrange/results_cache.goreturns theout-of-order TTL unconditionally when extents overlap the out-of-order window, with no
fallback when it is
0.Note the fallback has to be resolved per tenant before aggregating across tenants,
since
SmallestPositiveNonZeroDurationPerTenantdiscards zeros — otherwise a federatedquery loses the information about which tenant left the value unset.