Skip to content

Conversation

@francoposa
Copy link
Contributor

What this PR does

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]. If changelog entry is not needed, please add the changelog-not-needed label to the PR.
  • about-versioning.md updated with experimental features.

@francoposa
Copy link
Contributor Author

francoposa commented Dec 12, 2025

Right now, collecting the caching bucket stats in this way is not interesting because they are collected after each individual matcher test - if you run the same matcher over and over again you will of course hit the cache well and not have wasted data fetches.
Every benchmark case that hits the bucket has the same stats:

16206 get-range-bytes-fetched/op
0 get-range-bytes-refetched/op
61.00 get-range-bytes-requested/op
2.000 get-range-hits/op
2.000 get-range-ops/op

What we would want to is run a bunch of different matchers and then collect the caching bucket stats after they all run.
The suite of interesting test cases are seriesSelectionTestCases, for the higher level BenchmarkBucketIndexReader_ExpandedPostings.
Will need to bring these down to this area as well as fiddle with the test cache settings.

@francoposa
Copy link
Contributor Author

Further things to test after getting the more complete benchmark setup:

  • How does having a more dense sparse index-header impact object storage calls?

@francoposa francoposa force-pushed the francoposa/indexheader-bucket-reader-scratch branch from 492c9c1 to 38ec762 Compare December 15, 2025 17:59
@francoposa francoposa force-pushed the francoposa/indexheader-bucket-reader-scratch-decbuf-reader-stats branch from 7860176 to 6c80368 Compare December 15, 2025 18:00
francoposa added a commit that referenced this pull request Jan 7, 2026
<!--  Thanks for sending a pull request!  Before submitting:

1. Read our CONTRIBUTING.md guide
2. Rebase your PR if it gets out of sync with main
-->

#### What this PR does

Moves existing test fixtures defined in
`pkg/storegateway/bucket_test.go` to `pkg/storage/fixtures/fixtures.go`,
with some minor cleanup.
This makes the same test cases importable in both `pkg/storegateway` and
`pkg/storage`, allowing us to re-use the large, complex set of series
selector matcher test cases in both packages.

This is a preable to bringing in the rest of the indexheader-reader
benchmarks from the hackathon branch at
#13825.

#### Which issue(s) this PR fixes or relates to

Fixes #<issue number>

#### Checklist

- [x] Tests updated.
- [ ] Documentation added.
- [ ] `CHANGELOG.md` updated - the order of entries should be
`[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry
is not needed, please add the `changelog-not-needed` label to the PR.
- [ ]
[`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md)
updated with experimental features.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Introduces importable test utilities to simplify and unify TSDB
block/test data setup across packages.
> 
> - Adds `pkg/storage/fixtures` with `FsInstrumentedBucket`,
`SetupTestBlock`, `AppendTestSeries`, and `SeriesSelectorTestCases` for
reusable block creation and matcher cases
> - Refactors `storegateway` tests/benchmarks to use fixtures; removes
duplicated helpers (`prepareTestBlock`, `appendTestSeries`,
`seriesSelectionTestCases`) and `localBucket`
> - Adds `testBlockToBucketBlock` adapter to wrap
`fixtures.BucketTestBlock` for existing test code
> - Updates assertions/paths to use `FsInstrumentedBucket.RootDir()` and
shared constants
> 
> Scope limited to test code; no production code changes
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b911ff3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant