Skip to content

Commit

Permalink
Cut patch release v0.32.2 (#6685)
Browse files Browse the repository at this point in the history
* store: fix race when iterating blocks (#6675)

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* store: Record stats even on ExpandPostings error (#6679)

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Store: fix forgotten field in store stats merge (#6681)

Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>

* Store: fix postings reader short reads (#6684)

bufio.Reader can return less bytes than needed. Go documentation
suggests to use io.ReadFull

Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>

* Cut patch release v0.32.2

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
Co-authored-by: Michael Hoffmann <mhoffm@posteo.de>
  • Loading branch information
saswatamcode and MichaHoffmann authored Aug 31, 2023
1 parent 5bf3a9e commit 7f5c066
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
21 changes: 18 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,28 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re

### 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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.32.1
0.32.2
17 changes: 12 additions & 5 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1364,15 +1364,18 @@ func (s *BucketStore) Series(req *storepb.SeriesRequest, seriesSrv storepb.Store
"block.resolution": blk.meta.Thanos.Downsample.Resolution,
})

if err := blockClient.ExpandPostings(sortedBlockMatchers, seriesLimiter); err != nil {
span.Finish()
return errors.Wrapf(err, "fetch series for block %s", blk.meta.ULID)
}
onClose := func() {
mtx.Lock()
stats = blockClient.MergeStats(stats)
mtx.Unlock()
}

if err := blockClient.ExpandPostings(sortedBlockMatchers, seriesLimiter); err != nil {
onClose()
span.Finish()
return errors.Wrapf(err, "fetch postings for block %s", blk.meta.ULID)
}

part := newLazyRespSet(
srv.Context(),
span,
Expand Down Expand Up @@ -1693,6 +1696,9 @@ func (s *BucketStore) LabelNames(ctx context.Context, req *storepb.LabelNamesReq
}

func (s *BucketStore) UpdateLabelNames() {
s.mtx.RLock()
defer s.mtx.RUnlock()

newSet := stringset.New()
for _, b := range s.blocks {
labelNames, err := b.indexHeaderReader.LabelNames()
Expand Down Expand Up @@ -2844,7 +2850,7 @@ func (r *bucketIndexReader) fetchPostings(ctx context.Context, keys []labels.Lab
r.stats.PostingsFetchDurationSum += time.Since(begin)
r.mtx.Unlock()

if rdr.Error() != nil {
if err := rdr.Error(); err != nil {
return errors.Wrap(err, "reading postings")
}
return nil
Expand Down Expand Up @@ -3522,6 +3528,7 @@ type queryStats struct {
func (s queryStats) merge(o *queryStats) *queryStats {
s.blocksQueried += o.blocksQueried

s.postingsToFetch += o.postingsToFetch
s.postingsTouched += o.postingsTouched
s.PostingsTouchedSizeSum += o.PostingsTouchedSizeSum
s.postingsFetched += o.postingsFetched
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/postings.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func newPostingsReaderBuilder(ctx context.Context, r *bufio.Reader, postings []p
}

func getInt32(r io.Reader, buf []byte) (uint32, error) {
read, err := r.Read(buf)
read, err := io.ReadFull(r, buf)
if err != nil {
return 0, errors.Wrap(err, "reading")
}
Expand Down

0 comments on commit 7f5c066

Please sign in to comment.