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

chore(blooms): Remove excessive logging in fused querier #14152

Merged
merged 1 commit into from
Sep 17, 2024
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
4 changes: 2 additions & 2 deletions pkg/storage/bloom/v1/bloom_tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (bt *BloomTokenizer) Populate(blooms v2iter.SizedIterator[*Bloom], chks v2i
// We noticed some blooms are empty on the resulting blocks.
// We have the feeling that the empty blooms may be reused from old blocks.
// Here we log an error if we find an empty bloom.
if bloom.Count() == 0 {
if bloom.IsEmpty() {
level.Warn(bt.logger).Log("msg", "found existing empty bloom")
}
} else {
Expand Down Expand Up @@ -149,7 +149,7 @@ func (bt *BloomTokenizer) Populate(blooms v2iter.SizedIterator[*Bloom], chks v2i
}

// TODO(salvacorts): Delete this once we solve the correctness bug
if bloom.Count() == 0 {
if bloom.IsEmpty() {
level.Warn(bt.logger).Log("msg", "resulting bloom is empty")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we totally skip adding the bloom at all if empty?

}

Expand Down
4 changes: 4 additions & 0 deletions pkg/storage/bloom/v1/filter/scalable.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func (s *ScalableBloomFilter) Count() (ct int) {
return
}

func (s *ScalableBloomFilter) IsEmpty() bool {
return s.Count() == 0
}

// FillRatio returns the average ratio of set bits across every filter.
func (s *ScalableBloomFilter) FillRatio() float64 {
var sum, count float64
Expand Down
18 changes: 11 additions & 7 deletions pkg/storage/bloom/v1/fuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,18 @@ func (fq *FusedQuerier) runSeries(_ Schema, series *SeriesWithMeta, reqs []Reque
// Test each bloom individually
bloom := fq.bq.blooms.At()

// TODO(owen-d): this is a stopgap to avoid filtering broken blooms until we find their cause.
// This is a stopgap to avoid filtering on empty blooms.
// In the case we don't have any data in the bloom, don't filter any chunks.
if bloom.ScalableBloomFilter.Count() == 0 {
level.Warn(fq.logger).Log(
"msg", "Found bloom with no data",
"offset_page", offset.Page,
"offset_bytes", offset.ByteOffset,
)
// Empty blooms are generated from chunks that do not have entries with structured metadata.
if bloom.IsEmpty() {
// To debug empty blooms, uncomment the following block. Note that this may produce *a lot* of logs.
// swb := fq.bq.At()
// level.Debug(fq.logger).Log(
// "msg", "empty bloom",
// "series", swb.Fingerprint,
// "offset_page", offset.Page,
// "offset_bytes", offset.ByteOffset,
// )

for j := range reqs {
for k := range inputs[j].InBlooms {
Expand Down
Loading