Skip to content

Commit

Permalink
fix(blooms): Cleanup temp blockdir in bloom compactor (#13622)
Browse files Browse the repository at this point in the history
A follow up to #13522
This PR fixes the missing cleanup function call to remove temporary blocks from the filesystem.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
  • Loading branch information
chaudum authored Jul 23, 2024
1 parent 2b81a48 commit 64215e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/bloomcompactor/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ func (s *SimpleBloomController) buildGaps(
built, err := bloomshipper.BlockFrom(tenant, table.Addr(), blk)
if err != nil {
level.Error(logger).Log("msg", "failed to build block", "err", err)
if err = blk.Reader().Cleanup(); err != nil {
level.Error(logger).Log("msg", "failed to cleanup block directory", "err", err)
}
return nil, errors.Wrap(err, "failed to build block")
}

Expand All @@ -439,10 +442,17 @@ func (s *SimpleBloomController) buildGaps(
built,
); err != nil {
level.Error(logger).Log("msg", "failed to write block", "err", err)
if err = blk.Reader().Cleanup(); err != nil {
level.Error(logger).Log("msg", "failed to cleanup block directory", "err", err)
}
return nil, errors.Wrap(err, "failed to write block")
}
s.metrics.blocksCreated.Inc()

if err := blk.Reader().Cleanup(); err != nil {
level.Error(logger).Log("msg", "failed to cleanup block directory", "err", err)
}

totalGapKeyspace := (gap.bounds.Max - gap.bounds.Min)
progress := (built.Bounds.Max - gap.bounds.Min)
pct := float64(progress) / float64(totalGapKeyspace) * 100
Expand Down

0 comments on commit 64215e1

Please sign in to comment.