Skip to content

Commit

Permalink
Revert "[release-2.9] Upgrade to thanos 0.32.3 (stolostron#84)"
Browse files Browse the repository at this point in the history
This reverts commit 8727d9f.
Signed-off-by: Subbarao Meduri <smeduri@redhat.com>
  • Loading branch information
subbarao-meduri committed Nov 9, 2023
1 parent 8214b23 commit c2dccb9
Show file tree
Hide file tree
Showing 36 changed files with 730 additions and 1,078 deletions.
12 changes: 6 additions & 6 deletions .busybox-versions
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Auto generated by busybox-updater.sh. DO NOT EDIT
amd64=7926ace2c2ee4c8fd52ae5badcc409685bae02090f796e26ef7bb504245acaaa
arm64=2754fd36a6cd1753c82f7954477b9864a0d0d2f7825c9ad015f3f2ce58d82f14
arm=a2f2a8253820f58e0a9721045b9e5f61df2aef79d679a638e2b901d4be6e27df
ppc64le=5e26d389ce9d04cf55740944dab6d7896766fd21a5eca05201e0aef4eab96852
riscv64=d671b149d69a3497f12d802a2cb3bf490bc16d9f048583868176bd016f35da61
s390x=50895280c397af8998357e1a522a4f82774d6abeddc7a95bafeb10cb46692bba
amd64=650cefc7292b429ac55e3f9cc49a55a4cdd58698474310bb280c5e57adebf40a
arm64=63e8d2c5aa02d37f81bc9bfd80b92bbc59b31a0099a990649b887f861264b3b5
arm=810be036d4e95b015f26c01ba999a2e14fde69b5af0c264fe607971a35ba3787
ppc64le=b698a18e2d756e00697a63ac749825ee8c3f8a50133b8998dbed092c474c1f46
riscv64=02a69336c173007423c0be20cfd1c8a76b3fd6d4696a5b7c19022be9a631688b
s390x=72832339f6003c44a4cdf9d576efa3ff19d5ce55e27198b4089528bf0dd04788
41 changes: 3 additions & 38 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,19 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re

### Removed

## [v0.32.3](https://github.com/thanos-io/thanos/tree/release-0.32) - 20.09.2023

### Fixed

- [#6692](https://github.com/thanos-io/thanos/pull/6692) Store: Fix matching bug when using empty alternative in regex matcher, for example (a||b).
- [#6679](https://github.com/thanos-io/thanos/pull/6697) Store: Fix block deduplication
- [#6706](https://github.com/thanos-io/thanos/pull/6706) Store: Series responses should always be sorted

### Added

### Changed

- [#6664](https://github.com/thanos-io/thanos/pull/6664) *: Update Prometheus to 2.46.1.
- [#6722](https://github.com/thanos-io/thanos/pull/6722) *: Optimize iterations on GCS buckets by requesting only object names.
- [#6544](https://github.com/thanos-io/thanos/pull/6500) Objstore: Update objstore to latest version which adds a new metric regarding uploaded TSDB bytes

### Removed

## [v0.32.2](https://github.com/thanos-io/thanos/tree/release-0.32) - 31.08.2023

### Fixed

- [#6675](https://github.com/thanos-io/thanos/pull/6675) Store: Fix race when iterating blocks
- [#6679](https://github.com/thanos-io/thanos/pull/6679) store: Record stats even on ExpandPostings error
- [#6681](https://github.com/thanos-io/thanos/pull/6681) Store: Fix forgotten field in store stats merge
- [#6684](https://github.com/thanos-io/thanos/pull/6684) Store: Fix postings reader short reads to address nil postings bug

### Added

### Changed

### Removed

## [v0.32.1](https://github.com/thanos-io/thanos/tree/release-0.32) - 28.08.2023

### Fixed

- [#6650](https://github.com/thanos-io/thanos/pull/6650) Store: Fix error handling in decodePostings
- [#6654](https://github.com/thanos-io/thanos/pull/6654) Store: Fix ignored error in postings
- [#6655](https://github.com/thanos-io/thanos/pull/6655) Store: Fix bufio pool handling
- [#6650](https://github.com/thanos-io/thanos/pull/6650) Store: fix error handling in decodePostings
- [#6654](https://github.com/thanos-io/thanos/pull/6654) Store: fix ignored error in postings
- [#6655](https://github.com/thanos-io/thanos/pull/6655) Store: fix bufio pool handling
- [#6669](https://github.com/thanos-io/thanos/pull/6669) Store: Fix mutable stringset memory usage

### Added

### Changed

- [#6664](https://github.com/thanos-io/thanos/pull/6664) *: Update Prometheus to 2.46.1.

### Removed

## [v0.32.0](https://github.com/thanos-io/thanos/tree/release-0.32) - 23.08.2023
Expand Down
21 changes: 21 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Upgrade

When upgrading Thanos to a newer version, these are the sequences of commands that have been the most consistently accurate.

```bash
# make sure that there aren't already too many diffs between the current branch and the tag it's supposed to be replicating
$ git diff <current-upstream-tag> --name-only
```

```bash
# cherry pick the commits between the current upstream tag and the one you want to upgrade to
$ git cherry-pick -X theirs -m 1 <current-upstream-tag>..<upgrade-upstream-tag>
```

You may need to use `$ git cherry-pick --skip` a few times to reconcile empty commits, but this is fine.

To make sure it worked correctly:
```bash
# this should yield the same results as the first command, even though the new tag has been specified
$ git diff <upgrade-upstream-tag> --name-only
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.32.3
0.32.1
6 changes: 3 additions & 3 deletions cmd/thanos/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ func (b *erroringBucket) IsObjNotFoundErr(err error) bool {
return b.bkt.IsObjNotFoundErr(err)
}

// IsAccessDeniedErr returns true if error means that access to the object was denied.
func (b *erroringBucket) IsAccessDeniedErr(err error) bool {
return b.bkt.IsAccessDeniedErr(err)
// IsCustomerManagedKeyError returns true if error means that customer managed key is invalid.
func (b *erroringBucket) IsCustomerManagedKeyError(err error) bool {
return b.bkt.IsCustomerManagedKeyError(err)
}

// Attributes returns information about the specified object.
Expand Down
18 changes: 16 additions & 2 deletions cmd/thanos/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/relabel"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/wlog"
"google.golang.org/grpc"
"gopkg.in/yaml.v2"

Expand Down Expand Up @@ -86,7 +85,7 @@ func registerReceive(app *extkingpin.App) {
OutOfOrderTimeWindow: int64(time.Duration(*conf.tsdbOutOfOrderTimeWindow) / time.Millisecond),
OutOfOrderCapMax: conf.tsdbOutOfOrderCapMax,
NoLockfile: conf.noLockFile,
WALCompression: wlog.ParseCompressionType(conf.walCompression, string(wlog.CompressionSnappy)),
WALCompression: conf.walCompression,
MaxExemplars: conf.tsdbMaxExemplars,
EnableExemplarStorage: conf.tsdbMaxExemplars > 0,
HeadChunksWriteQueueSize: int(conf.tsdbWriteQueueSize),
Expand Down Expand Up @@ -366,6 +365,21 @@ func runReceive(
grpcserver.WithTLSConfig(tlsCfg),
)

ctx, cancel := context.WithCancel(context.Background())
level.Debug(logger).Log("msg", "setting up periodic update for label names")
g.Add(func() error {
return runutil.Repeat(10*time.Second, ctx.Done(), func() error {
level.Debug(logger).Log("msg", "Starting label names update")

dbs.UpdateLabelNames(ctx)

level.Debug(logger).Log("msg", "Finished label names update")
return nil
})
}, func(err error) {
cancel()
})

g.Add(
func() error {
level.Info(logger).Log("msg", "listening for StoreAPI and WritableStoreAPI gRPC", "address", conf.grpcConfig.bindAddress)
Expand Down
5 changes: 2 additions & 3 deletions cmd/thanos/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"github.com/prometheus/prometheus/storage/remote"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/agent"
"github.com/prometheus/prometheus/tsdb/wlog"
"github.com/prometheus/prometheus/util/strutil"

"github.com/thanos-io/objstore"
Expand Down Expand Up @@ -167,11 +166,11 @@ func registerRule(app *extkingpin.App) {
MaxBlockDuration: int64(time.Duration(*tsdbBlockDuration) / time.Millisecond),
RetentionDuration: int64(time.Duration(*tsdbRetention) / time.Millisecond),
NoLockfile: *noLockFile,
WALCompression: wlog.ParseCompressionType(*walCompression, string(wlog.CompressionSnappy)),
WALCompression: *walCompression,
}

agentOpts := &agent.Options{
WALCompression: wlog.ParseCompressionType(*walCompression, string(wlog.CompressionSnappy)),
WALCompression: *walCompression,
NoLockfile: *noLockFile,
}

Expand Down
47 changes: 44 additions & 3 deletions cmd/thanos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
"github.com/thanos-io/thanos/pkg/shipper"
"github.com/thanos-io/thanos/pkg/store"
"github.com/thanos-io/thanos/pkg/store/labelpb"
"github.com/thanos-io/thanos/pkg/stringset"
"github.com/thanos-io/thanos/pkg/targets"
"github.com/thanos-io/thanos/pkg/tls"
)
Expand Down Expand Up @@ -112,8 +113,9 @@ func runSidecar(
mint: conf.limitMinTime.PrometheusTimestamp(),
maxt: math.MaxInt64,

limitMinTime: conf.limitMinTime,
client: promclient.NewWithTracingClient(logger, httpClient, "thanos-sidecar"),
limitMinTime: conf.limitMinTime,
client: promclient.NewWithTracingClient(logger, httpClient, "thanos-sidecar"),
labelNamesSet: stringset.AllStrings(),
}

confContentYaml, err := conf.objStore.Content()
Expand Down Expand Up @@ -237,6 +239,19 @@ func runSidecar(
}, func(error) {
cancel()
})

g.Add(func() error {
return runutil.Repeat(10*time.Second, ctx.Done(), func() error {
level.Debug(logger).Log("msg", "Starting label names update")

m.UpdateLabelNames(context.Background())

level.Debug(logger).Log("msg", "Finished label names update")
return nil
})
}, func(err error) {
cancel()
})
}
{
ctx, cancel := context.WithCancel(context.Background())
Expand All @@ -249,7 +264,7 @@ func runSidecar(
{
c := promclient.NewWithTracingClient(logger, httpClient, httpconfig.ThanosUserAgent)

promStore, err := store.NewPrometheusStore(logger, reg, c, conf.prometheus.url, component.Sidecar, m.Labels, m.Timestamps, m.Version)
promStore, err := store.NewPrometheusStore(logger, reg, c, conf.prometheus.url, component.Sidecar, m.Labels, m.Timestamps, m.LabelNamesSet, m.Version)
if err != nil {
return errors.Wrap(err, "create Prometheus store")
}
Expand Down Expand Up @@ -419,6 +434,8 @@ type promMetadata struct {
limitMinTime thanosmodel.TimeOrDurationValue

client *promclient.Client

labelNamesSet stringset.Set
}

func (s *promMetadata) UpdateLabels(ctx context.Context) error {
Expand Down Expand Up @@ -446,6 +463,30 @@ func (s *promMetadata) UpdateTimestamps(mint, maxt int64) {
s.maxt = maxt
}

func (s *promMetadata) UpdateLabelNames(ctx context.Context) {
mint, _ := s.Timestamps()
labelNames, err := s.client.LabelNamesInGRPC(ctx, s.promURL, nil, mint, time.Now().UnixMilli())
if err != nil {
s.mtx.Lock()
defer s.mtx.Unlock()

s.labelNamesSet = stringset.AllStrings()
return
}

filter := stringset.NewFromStrings(labelNames...)
s.mtx.Lock()
s.labelNamesSet = filter
s.mtx.Unlock()
}

func (s *promMetadata) LabelNamesSet() stringset.Set {
s.mtx.Lock()
defer s.mtx.Unlock()

return s.labelNamesSet
}

func (s *promMetadata) Labels() labels.Labels {
s.mtx.Lock()
defer s.mtx.Unlock()
Expand Down
17 changes: 17 additions & 0 deletions cmd/thanos/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,23 @@ func runStore(
})
}

{
ctx, cancel := context.WithCancel(context.Background())
level.Debug(logger).Log("msg", "setting up periodic update for label names")
g.Add(func() error {
return runutil.Repeat(10*time.Second, ctx.Done(), func() error {
level.Debug(logger).Log("msg", "Starting label names update")

bs.UpdateLabelNames()

level.Debug(logger).Log("msg", "Finished label names update")
return nil
})
}, func(err error) {
cancel()
})

}
// Add bucket UI for loaded blocks.
{
ins := extpromhttp.NewInstrumentationMiddleware(reg, nil)
Expand Down
10 changes: 10 additions & 0 deletions docs/components/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ thanos query \

This logic can also be controlled via parameter on QueryAPI. More details below.

### Deduplication on non-external labels

In `v0.31.0` we have implemented an [optimization](../proposals-accepted/20221129-avoid-global-sort.md) which broke deduplication on non-external labels. We think that it was just a coincidence that deduplication worked at all on non-external labels in previous versions.

External labels always override any labels a series might have and this makes it so that it is possible to remove replica labels on series returned by a StoreAPI as an optimization. If deduplication happens on internal labels then that might lead to unsorted series from a StoreAPI and that breaks deduplication.

To fix this use-case, in 0.32.0 we've implemented a cuckoo filter on label names that is updated every 10 seconds. Using it we can detect whether deduplication was requested on internal labels. If that is the case then the series set is resorted before being sent off to the querier. It is strongly recommended to set replica labels which are external labels because otherwise the optimization cannot be applied and your queries will be slower by 20-30%.

In the future we have plans to expose this cuckoo filter through the InfoAPI. This will allow better scoping queries to StoreAPIs.

## Experimental PromQL Engine

By default, Thanos querier comes with standard Prometheus PromQL engine. However, when `--query.promql-engine=thanos` is specified, Thanos will use [experimental Thanos PromQL engine](http://github.com/thanos-community/promql-engine) which is a drop-in, efficient implementation of PromQL engine with query planner and optimizers.
Expand Down
1 change: 0 additions & 1 deletion docs/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ type: AZURE
config:
storage_account: ""
storage_account_key: ""
storage_connection_string: ""
container: ""
endpoint: ""
user_assigned_id: ""
Expand Down
Loading

0 comments on commit c2dccb9

Please sign in to comment.