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

Simplify compactor and respect resolutions #195

Merged
merged 4 commits into from
Mar 9, 2018
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
2 changes: 1 addition & 1 deletion cmd/thanos/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func runBucketCheck(logger log.Logger, bkt objstore.Bucket, repair bool) error {
for _, id := range all {
level.Info(logger).Log("msg", "verify block", "id", id)

if err := verifyBlock(ctx, bkt, id); err != nil {
if err = verifyBlock(ctx, bkt, id); err != nil {
level.Warn(logger).Log("msg", "detected issue", "id", id, "err", err)
}
if err == nil || !repair {
Expand Down
35 changes: 21 additions & 14 deletions cmd/thanos/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func runCompact(

bkt = objstore.BucketWithMetrics(bucket, bkt, reg)

sy, err := compact.NewSyncer(logger, reg, dataDir, bkt, syncDelay)
sy, err := compact.NewSyncer(logger, reg, bkt, syncDelay)
if err != nil {
return err
}
Expand Down Expand Up @@ -143,19 +143,26 @@ func runCompact(
if err := sy.GarbageCollect(ctx); err != nil {
level.Error(logger).Log("msg", "garbage collection failed", "err", err)
}
for _, g := range sy.Groups() {
if _, err := g.Compact(ctx, comp); err != nil {
level.Error(logger).Log("msg", "compaction failed", "err", err)
// The HaltError type signals that we hit a critical bug and should block
// for investigation.
if compact.IsHaltError(err) {
if haltOnError {
level.Error(logger).Log("msg", "critical error detected; halting")
halted.Set(1)
select {}
} else {
return errors.Wrap(err, "critical error detected")
}
groups, err := sy.Groups()
if err != nil {
return errors.Wrap(err, "build compaction groups")
}
for _, g := range groups {
os.RemoveAll(dataDir)
Copy link
Member

Choose a reason for hiding this comment

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

why is that here? (: We don't need any cache anymore?

Copy link
Member

Choose a reason for hiding this comment

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

... ahh are we caching only meta json in memory and download them + blocks on compaction only.

That makes sense, cool 👍

// While we do all compactions sequentially we just compact within the top-level dir.
if _, err := g.Compact(ctx, dataDir, comp); err == nil {
continue
}
level.Error(logger).Log("msg", "compaction failed", "err", err)
// The HaltError type signals that we hit a critical bug and should block
// for investigation.
if compact.IsHaltError(err) {
if haltOnError {
level.Error(logger).Log("msg", "critical error detected; halting")
halted.Set(1)
select {}
} else {
return errors.Wrap(err, "critical error detected")
}
}
}
Expand Down
Loading