Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cut patch release v0.32.1 #6670

Merged
merged 5 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,22 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re

### Removed

## [v0.32.0](https://github.com/thanos-io/thanos/tree/release-v0.32.0) - 23.08.2023
## [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
- [#6669](https://github.com/thanos-io/thanos/pull/6669) Store: Fix mutable stringset memory usage

### Added

### Changed

### Removed

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

### Added

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.32.0
0.32.1
11 changes: 5 additions & 6 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -2792,13 +2792,13 @@ func (r *bucketIndexReader) fetchPostings(ctx context.Context, keys []labels.Lab
// We assume index does not have any ptrs that has 0 length.
length := int64(part.End) - start

brdr := bufioReaderPool.Get().(*bufio.Reader)
defer bufioReaderPool.Put(brdr)

// Fetch from object storage concurrently and update stats and posting list.
g.Go(func() error {
begin := time.Now()

brdr := bufioReaderPool.Get().(*bufio.Reader)
defer bufioReaderPool.Put(brdr)

partReader, err := r.block.bkt.GetRange(ctx, r.block.indexFilename(), start, length)
if err != nil {
return errors.Wrap(err, "read postings range")
Expand Down Expand Up @@ -2864,14 +2864,13 @@ func (r *bucketIndexReader) decodeCachedPostings(b []byte) (index.Postings, []fu
)
if isDiffVarintSnappyEncodedPostings(b) || isDiffVarintSnappyStreamedEncodedPostings(b) {
s := time.Now()
clPostings, err := decodePostings(b)
l, err = decodePostings(b)
r.stats.cachedPostingsDecompressions += 1
r.stats.CachedPostingsDecompressionTimeSum += time.Since(s)
if err != nil {
r.stats.cachedPostingsDecompressionErrors += 1
} else {
closeFns = append(closeFns, clPostings.close)
l = clPostings
closeFns = append(closeFns, l.(closeablePostings).close)
}
} else {
_, l, err = r.dec.Postings(b)
Expand Down
1 change: 1 addition & 0 deletions pkg/store/bucket_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ func TestBucketStore_LabelNamesSet_e2e(t *testing.T) {
for _, n := range []string{"a", "b", "c"} {
testutil.Assert(t, filter.Has(n), "expected filter to have %s", n)
}
testutil.Equals(t, 3, filter.Count())
})
}

Expand Down
12 changes: 12 additions & 0 deletions pkg/store/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3330,3 +3330,15 @@ func TestExpandedPostingsRace(t *testing.T) {
wg.Wait()
}
}

func TestBucketIndexReader_decodeCachedPostingsErrors(t *testing.T) {
bir := bucketIndexReader{stats: &queryStats{}}
t.Run("should return error on broken cached postings without snappy prefix", func(t *testing.T) {
_, _, err := bir.decodeCachedPostings([]byte("foo"))
testutil.NotOk(t, err)
})
t.Run("should return error on broken cached postings with snappy prefix", func(t *testing.T) {
_, _, err := bir.decodeCachedPostings(append([]byte(codecHeaderSnappy), []byte("foo")...))
testutil.NotOk(t, err)
})
}
1 change: 1 addition & 0 deletions pkg/store/postings.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func (r *postingsReaderBuilder) Next() bool {

_, err := r.r.Discard(int(from - r.lastOffset))
if err != nil {
r.e = err
return false
}
r.lastOffset += from - r.lastOffset
Expand Down
18 changes: 17 additions & 1 deletion pkg/stringset/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (
type Set interface {
Has(string) bool
HasAny([]string) bool
// Count returns the number of elements in the set.
// A value of -1 indicates infinite size and can be returned by a
// set representing all possible string values.
Count() int
}

type fixedSet struct {
Expand Down Expand Up @@ -38,6 +42,10 @@ func (f fixedSet) Has(s string) bool {
return f.cuckoo.Lookup([]byte(s))
}

func (f fixedSet) Count() int {
return int(f.cuckoo.Count())
}

type mutableSet struct {
cuckoo *cuckoo.ScalableCuckooFilter
}
Expand All @@ -54,7 +62,7 @@ func New() MutableSet {
}

func (e mutableSet) Insert(s string) {
e.cuckoo.Insert([]byte(s))
e.cuckoo.InsertUnique([]byte(s))
}

func (e mutableSet) Has(s string) bool {
Expand All @@ -70,6 +78,10 @@ func (e mutableSet) HasAny(strings []string) bool {
return false
}

func (e mutableSet) Count() int {
return int(e.cuckoo.Count())
}

type allStringsSet struct{}

func (e allStringsSet) HasAny(_ []string) bool {
Expand All @@ -83,3 +95,7 @@ func AllStrings() *allStringsSet {
func (e allStringsSet) Has(_ string) bool {
return true
}

func (e allStringsSet) Count() int {
return -1
}
Loading