diff --git a/app/vmselect/prometheus/prometheus.go b/app/vmselect/prometheus/prometheus.go index 0442eead8f..63b5bb1600 100644 --- a/app/vmselect/prometheus/prometheus.go +++ b/app/vmselect/prometheus/prometheus.go @@ -794,6 +794,9 @@ func QueryHandler(qt *querytracer.Tracer, startTime time.Time, at *auth.Token, w start -= offset end := start start = end - window + if start < 0 { + start = 0 + } // Do not include data point with a timestamp matching the lower boundary of the window as Prometheus does. start++ if end < start { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b5fa32d469..5201d52bd1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,8 @@ The following `tip` changes can be tested by building VictoriaMetrics components ## v1.93.x long-time support release (LTS) +* BUGFIX: [vmselect](https://docs.victoriametrics.com/vmselect.html): properly determine time range search for instant queries with too big look-behind window like `foo[100y]`. Previously, such queries could return empty responses even if `foo` is present in database. + ## [v1.93.10](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.93.10) Released at 2024-01-17