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

Add e2e tests for bloom filtering #11645

Merged
merged 15 commits into from
Jan 12, 2024
Merged

Add e2e tests for bloom filtering #11645

merged 15 commits into from
Jan 12, 2024

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Jan 10, 2024

What?

This PR adds an end-to-end integration test for creating bloom filters and using them in the gateway to filter chunks.

Why?

This test helped to identify bugs in the bloom shipper code that would have taken a very long time to discover in other ways, such as deploying to a dev environment or running a long-running docker compose setup.

Notes

The following commits of this PR are actual changes to the compactor/gateway code to make e2e test work:

The bloom gateway code path for processing blocks was cleaned up, because it still contained the unused "sequention processing" path of blocks, which was initially kept to verify the callback based processing works alike:

A test that both builds bloom filters as well as uses them for filtering
chunk refs when querying.

Signed-off-by: Christian Haudum <[email protected]>
Signed-off-by: Christian Haudum <[email protected]>
Signed-off-by: Christian Haudum <[email protected]>
Signed-off-by: Christian Haudum <[email protected]>
@chaudum chaudum force-pushed the chaudum/bloom-filter-e2e-test branch from f408ceb to f55d79b Compare January 11, 2024 09:20
@chaudum chaudum marked this pull request as ready for review January 11, 2024 13:45
@chaudum chaudum requested a review from a team as a code owner January 11, 2024 13:45
pkg/storage/stores/shipper/bloomshipper/shipper.go Outdated Show resolved Hide resolved
// isOutsideRange tests if a given BlockRef b is outside of search boundaries
// defined by min/max timestamp and min/max fingerprint.
// Fingerprint ranges must be sorted in ascending order.
func isOutsideRange(b *BlockRef, startTimestamp, endTimestamp model.Time, fingerprints [][2]uint64) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would create a struct, maybe FpRange and pass []FpRange into this function. it would make the code more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See commit db61f73

// this is already covered in the range check above, but I keep it as a second gate
if idx > len(fingerprints)-1 {
return true
prev := fpRange{0, 0}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be written as

Suggested change
prev := fpRange{0, 0}
var prev fpRange

@chaudum chaudum merged commit 6bcac00 into main Jan 12, 2024
8 checks passed
@chaudum chaudum deleted the chaudum/bloom-filter-e2e-test branch January 12, 2024 08:26
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
**What?**

This PR adds an end-to-end integration test for creating bloom filters
and using them in the gateway to filter chunks.

**Why?**

This test helped to identify bugs in the bloom shipper code that would
have taken a very long time to discover in other ways, such as deploying
to a dev environment or running a long-running docker compose setup.

**Notes**

The following commits of this PR are actual changes to the
compactor/gateway code to make e2e test work:

* grafana@2dcc761
* grafana@84052dd
* grafana@3ba44f8

The bloom gateway code path for processing blocks was cleaned up,
because it still contained the unused "sequention processing" path of
blocks, which was initially kept to verify the callback based processing
works alike:

* grafana@f55d79b

---------

Signed-off-by: Christian Haudum <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants