From 5274b4a2d8ed4f33ab3dd48e3e9c9b7135e835a3 Mon Sep 17 00:00:00 2001 From: Justin Jung Date: Mon, 13 Mar 2023 21:33:26 -0700 Subject: [PATCH] Disable scalar for vertical sharding Signed-off-by: Justin Jung --- CHANGELOG.md | 1 + pkg/querysharding/analyzer.go | 2 +- pkg/querysharding/analyzer_test.go | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 964a3fd328f..da7a7384cfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ### Changed - [#6168](https://github.com/thanos-io/thanos/pull/6168) Receiver: Make ketama hashring fail early when configured with number of nodes lower than the replication factor. - [#6201](https://github.com/thanos-io/thanos/pull/6201) Query-Frontend: Disable absent and absent_over_time for vertical sharding. +- [#6212](https://github.com/thanos-io/thanos/pull/6212) Query-Frontend: Disable scalar for vertical sharding. ### Removed diff --git a/pkg/querysharding/analyzer.go b/pkg/querysharding/analyzer.go index 37a0d30296e..12cb1b9a1a0 100644 --- a/pkg/querysharding/analyzer.go +++ b/pkg/querysharding/analyzer.go @@ -105,7 +105,7 @@ func (a *QueryAnalyzer) Analyze(query string) (QueryAnalysis, error) { if n.Func.Name == "label_join" || n.Func.Name == "label_replace" { dstLabel := stringFromArg(n.Args[1]) dynamicLabels = append(dynamicLabels, dstLabel) - } else if n.Func.Name == "absent_over_time" || n.Func.Name == "absent" { + } else if n.Func.Name == "absent_over_time" || n.Func.Name == "absent" || n.Func.Name == "scalar" { isShardable = false return notShardableErr } diff --git a/pkg/querysharding/analyzer_test.go b/pkg/querysharding/analyzer_test.go index 6faa6e839fb..b86721706cf 100644 --- a/pkg/querysharding/analyzer_test.go +++ b/pkg/querysharding/analyzer_test.go @@ -75,6 +75,10 @@ http_requests_total`, name: "absent is not shardable", expression: `sum by (url) (absent(http_requests_total{code="400"}))`, }, + { + name: "scalar is not shardable", + expression: `scalar(sum by (url) (http_requests_total{code="400"}))`, + }, } shardableByLabels := []testCase{