From aec6a72096d245b265f3da681c2e17aa42c3a7ca Mon Sep 17 00:00:00 2001 From: Frederic Branczyk Date: Tue, 24 Mar 2020 10:35:08 +0100 Subject: [PATCH 1/2] pkg/store: Report no data if no stores discovered Signed-off-by: Frederic Branczyk --- pkg/store/proxy.go | 4 ++-- pkg/store/proxy_test.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/store/proxy.go b/pkg/store/proxy.go index 5aeaca3258..8440de2f96 100644 --- a/pkg/store/proxy.go +++ b/pkg/store/proxy.go @@ -109,9 +109,9 @@ func (s *ProxyStore) Info(ctx context.Context, r *storepb.InfoRequest) (*storepb maxTime := int64(0) stores := s.stores() - // Edge case: we have all of the data if there are no stores. + // Edge case: we have no data if there are no stores. if len(stores) == 0 { - res.MaxTime = math.MaxInt64 + res.MaxTime = 0 res.MinTime = 0 return res, nil diff --git a/pkg/store/proxy_test.go b/pkg/store/proxy_test.go index c90247ee39..1e49cce456 100644 --- a/pkg/store/proxy_test.go +++ b/pkg/store/proxy_test.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "math" "os" "sort" "testing" @@ -69,7 +68,7 @@ func TestProxyStore_Info(t *testing.T) { testutil.Equals(t, []storepb.LabelSet(nil), resp.LabelSets) testutil.Equals(t, storepb.StoreType_QUERY, resp.StoreType) testutil.Equals(t, int64(0), resp.MinTime) - testutil.Equals(t, int64(math.MaxInt64), resp.MaxTime) + testutil.Equals(t, int64(0), resp.MaxTime) } func TestProxyStore_Series(t *testing.T) { From 2ee189907984fba520dd4296268b9880a9665670 Mon Sep 17 00:00:00 2001 From: Frederic Branczyk Date: Tue, 24 Mar 2020 10:45:35 +0100 Subject: [PATCH 2/2] CHANGELOG.md: Add timespan reported on empty stores Signed-off-by: Frederic Branczyk --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fa0b16735..e40362fd54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Since there are no consistency guarantees provided by some Object Storage provid - [#2090](https://github.com/thanos-io/thanos/issues/2090) *breaking* Downsample command: the `downsample` command has moved as the `thanos bucket` sub-command, and cannot be called via `thanos downsample` any more. - [#2294](https://github.com/thanos-io/thanos/pull/2294) store: optimizations for fetching postings. Queries using `=~".*"` matchers or negation matchers (`!=...` or `!~...`) benefit the most. - [#2301](https://github.com/thanos-io/thanos/pull/2301) Ruler: initlialization fails with filepath bad pattern error and rule manager update error. +- [#2310](https://github.com/thanos-io/thanos/pull/2310) query: Report timespan 0 to 0 when discovering no stores. ## [v0.11.0](https://github.com/thanos-io/thanos/releases/tag/v0.11.0) - 2020.03.02