Skip to content

Commit

Permalink
remove all cache dirs at the end of each run
Browse files Browse the repository at this point in the history
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
  • Loading branch information
krasi-georgiev committed Sep 30, 2019
1 parent 973876f commit 95757ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/thanos/downsample.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ func downsampleBucket(
if err := os.MkdirAll(dir, 0777); err != nil {
return errors.Wrap(err, "create dir")
}

defer func() {
if err := os.RemoveAll(dir); err != nil {
level.Error(logger).Log("msg", "failed to remove downsample cache directory", "path", dir, "err", err)
}
}()

var metas []*metadata.Meta

err := bkt.Iter(ctx, "", func(name string) error {
Expand Down
5 changes: 5 additions & 0 deletions pkg/compact/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,11 @@ func NewBucketCompactor(

// Compact runs compaction over bucket.
func (c *BucketCompactor) Compact(ctx context.Context) error {
defer func() {
if err := os.RemoveAll(c.compactDir); err != nil {
level.Error(c.logger).Log("msg", "failed to remove compaction cache directory", "path", c.compactDir, "err", err)
}
}()
// Loop over bucket and compact until there's no work left.
for {
var (
Expand Down

0 comments on commit 95757ea

Please sign in to comment.