diff --git a/app/vmselect/prometheus/prometheus.go b/app/vmselect/prometheus/prometheus.go index 63b5bb160..0442eead8 100644 --- a/app/vmselect/prometheus/prometheus.go +++ b/app/vmselect/prometheus/prometheus.go @@ -794,9 +794,6 @@ 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/app/vmselect/promql/eval.go b/app/vmselect/promql/eval.go index 421f4b63c..d2497682b 100644 --- a/app/vmselect/promql/eval.go +++ b/app/vmselect/promql/eval.go @@ -1105,9 +1105,6 @@ func evalRollupFuncWithMetricExpr(qt *querytracer.Tracer, ec *EvalConfig, funcNa } else { minTimestamp -= ec.Step } - if minTimestamp < 0 { - minTimestamp = 0 - } sq := storage.NewSearchQuery(ec.AuthToken.AccountID, ec.AuthToken.ProjectID, minTimestamp, ec.End, tfss, ec.MaxSeries) rss, isPartial, err := netstorage.ProcessSearchQuery(qt, ec.DenyPartialResponse, sq, ec.Deadline) if err != nil { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9e95c344c..14cb63bc7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,9 +11,9 @@ 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. * BUGFIX: properly return errors from [export APIs](https://docs.victoriametrics.com/#how-to-export-time-series). Previously these errors were silently suppressed. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5649). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): properly discover targets for `role: endpoints` and `role: endpointslice` in [kubernetes_sd_configs](https://docs.victoriametrics.com/sd_configs.html#kubernetes_sd_configs). Previously some `endpoints` and `endpointslice` targets could be left undiscovered or some targets could have missing `__meta_*` labels when performing service discovery in busy Kubernetes clusters with large number of pods. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5557). +* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly process queries with too big lookbehind window such as `foo[100y]`. Previously, such queries could return empty responses even if `foo` is present in database. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5553). * BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly handle possible negative results caused by float operations precision error in rollup functions like rate() or increase(). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5571). ## [v1.93.10](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.93.10) diff --git a/lib/storage/search.go b/lib/storage/search.go index 61c42e5e6..0b918ea54 100644 --- a/lib/storage/search.go +++ b/lib/storage/search.go @@ -300,6 +300,10 @@ func (sq *SearchQuery) GetTimeRange() TimeRange { // NewSearchQuery creates new search query for the given args. func NewSearchQuery(accountID, projectID uint32, start, end int64, tagFilterss [][]TagFilter, maxMetrics int) *SearchQuery { + if start < 0 { + // This is needed for https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5553 + start = 0 + } if maxMetrics <= 0 { maxMetrics = 2e9 }