Skip to content

Commit

Permalink
Merge pull request #96 from vinted/pull_overlap_change
Browse files Browse the repository at this point in the history
don't halt compaction due to overlapping sources when vertical compac…
  • Loading branch information
GiedriusS authored Apr 9, 2024
2 parents f779b38 + 14378e7 commit bba1b1b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/compact/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,14 +816,17 @@ type CompactionLifecycleCallback interface {
type DefaultCompactionLifecycleCallback struct {
}

func (c DefaultCompactionLifecycleCallback) PreCompactionCallback(_ context.Context, _ log.Logger, _ *Group, toCompactBlocks []*metadata.Meta) error {
func (c DefaultCompactionLifecycleCallback) PreCompactionCallback(_ context.Context, logger log.Logger, cg *Group, toCompactBlocks []*metadata.Meta) error {
// Due to #183 we verify that none of the blocks in the plan have overlapping sources.
// This is one potential source of how we could end up with duplicated chunks.
uniqueSources := map[ulid.ULID]struct{}{}
for _, m := range toCompactBlocks {
for _, s := range m.Compaction.Sources {
if _, ok := uniqueSources[s]; ok {
return halt(errors.Errorf("overlapping sources detected for plan %v", toCompactBlocks))
if !cg.enableVerticalCompaction {
return halt(errors.Errorf("overlapping sources detected for plan %v", toCompactBlocks))
}
level.Warn(logger).Log("msg", "overlapping sources detected for plan", "duplicated_block", s, "to_compact_blocks", fmt.Sprintf("%v", toCompactBlocks))
}
uniqueSources[s] = struct{}{}
}
Expand Down

0 comments on commit bba1b1b

Please sign in to comment.