Skip to content

Commit

Permalink
chore(blooms): Remove excessive logging in fused querier (#14152)
Browse files Browse the repository at this point in the history
The FusedQuerier emits a large amount of log lines at level WARN if a bloom is empty. Since the introduction of structured metadata blooms, this happens every time a series does not have structured metadata in any of its entries.

In the future, an optimisation could be to not write blooms for series at all, if they contain no data.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
  • Loading branch information
chaudum authored Sep 17, 2024
1 parent 78b275b commit 6e36041
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
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")
}

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

0 comments on commit 6e36041

Please sign in to comment.