-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix(blooms): Match series to newest block only #15481
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a1aac43
fix(blooms): Match series to newest block only
chaudum 3850e63
fixup! fix(blooms): Match series to newest block only
chaudum 8227c53
fixup! fixup! fix(blooms): Match series to newest block only
chaudum 92692e2
fix: Populate "Sources" field in metas correctly
chaudum f566b92
fixup! fix: Populate "Sources" field in metas correctly
chaudum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import ( | |
| "github.com/grafana/loki/v3/pkg/logproto" | ||
| v1 "github.com/grafana/loki/v3/pkg/storage/bloom/v1" | ||
| "github.com/grafana/loki/v3/pkg/storage/stores/shipper/bloomshipper" | ||
| "github.com/grafana/loki/v3/pkg/storage/stores/shipper/indexshipper/tsdb" | ||
| ) | ||
|
|
||
| func makeBlockRef(minFp, maxFp model.Fingerprint, from, through model.Time) bloomshipper.BlockRef { | ||
|
|
@@ -28,6 +29,9 @@ func makeMeta(minFp, maxFp model.Fingerprint, from, through model.Time) bloomshi | |
| Blocks: []bloomshipper.BlockRef{ | ||
| makeBlockRef(minFp, maxFp, from, through), | ||
| }, | ||
| Sources: []tsdb.SingleTenantTSDBIdentifier{ | ||
| {TS: through.Time()}, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -100,14 +104,21 @@ func TestBlockResolver_BlocksMatchingSeries(t *testing.T) { | |
|
|
||
| t.Run("multiple overlapping blocks within time range covering full keyspace", func(t *testing.T) { | ||
| metas := []bloomshipper.Meta{ | ||
| makeMeta(0x00, 0xdf, 1000, 1999), | ||
| makeMeta(0xc0, 0xff, 1000, 1999), | ||
| // 2 series overlap | ||
| makeMeta(0x00, 0xdf, 1000, 1499), // "old" meta covers first 4 series | ||
| makeMeta(0xc0, 0xff, 1500, 1999), // "new" meta covers last 4 series | ||
| } | ||
| res := blocksMatchingSeries(metas, interval, series) | ||
| for i := range res { | ||
| t.Logf("%s", res[i].block) | ||
| for j := range res[i].series { | ||
| t.Logf(" %016x", res[i].series[j].Fingerprint) | ||
| } | ||
| } | ||
|
Comment on lines
+112
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mainly for debugging |
||
| expected := []blockWithSeries{ | ||
| { | ||
| block: metas[0].Blocks[0], | ||
| series: series[0:4], | ||
| series: series[0:2], // series 0x00c0 and 0x00d0 are covered in the newer block | ||
| }, | ||
| { | ||
| block: metas[1].Blocks[0], | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.