Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [ENHANCEMENT] Ruler: Add DecodingConcurrency config flag for Thanos Engine. #7118
* [ENHANCEMENT] Compactor: Avoid double compaction by cleaning partition files in 2 cycles. #7129
* [ENHANCEMENT] Distributor: Optimize memory usage by recycling v2 requests. #7131
* [ENHANCEMENT] Compactor: Avoid double compaction by not filtering delete blocks on real time when using bucketIndex lister. #7156
* [BUGFIX] Ring: Change DynamoDB KV to retry indefinitely for WatchKey. #7088
* [BUGFIX] Ruler: Add XFunctions validation support. #7111
* [BUGFIX] Querier: propagate Prometheus info annotations in protobuf responses. #7132
Expand Down
32 changes: 21 additions & 11 deletions pkg/compactor/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,8 @@ func (c *Compactor) compactUser(ctx context.Context, userID string) error {
noCompactMarkerFilter := compact.NewGatherNoCompactionMarkFilter(ulogger, bucket, c.compactorCfg.MetaSyncConcurrency)

var blockLister block.Lister
switch cortex_tsdb.BlockDiscoveryStrategy(c.storageCfg.BucketStore.BlockDiscoveryStrategy) {
blockDiscoveryStrategy := cortex_tsdb.BlockDiscoveryStrategy(c.storageCfg.BucketStore.BlockDiscoveryStrategy)
switch blockDiscoveryStrategy {
case cortex_tsdb.ConcurrentDiscovery:
blockLister = block.NewConcurrentLister(ulogger, bucket)
case cortex_tsdb.RecursiveDiscovery:
Expand All @@ -1038,6 +1039,24 @@ func (c *Compactor) compactUser(ctx context.Context, userID string) error {
return cortex_tsdb.ErrBlockDiscoveryStrategy
}

// List of filters to apply (order matters).
filterList := []block.MetadataFilter{
// Remove the ingester ID because we don't shard blocks anymore, while still
// honoring the shard ID if sharding was done in the past.
NewLabelRemoverFilter([]string{cortex_tsdb.IngesterIDExternalLabel}),
block.NewConsistencyDelayMetaFilter(ulogger, c.compactorCfg.ConsistencyDelay, reg),
}

// Add ignoreDeletionMarkFilter only when not using bucket index discovery.
if blockDiscoveryStrategy != cortex_tsdb.BucketIndexDiscovery {
filterList = append(filterList, ignoreDeletionMarkFilter)
}

filterList = append(filterList,
deduplicateBlocksFilter,
noCompactMarkerFilter,
)

fetcher, err := block.NewMetaFetcherWithMetrics(
ulogger,
c.compactorCfg.MetaSyncConcurrency,
Expand All @@ -1046,16 +1065,7 @@ func (c *Compactor) compactUser(ctx context.Context, userID string) error {
c.metaSyncDirForUser(userID),
c.compactorMetrics.getBaseFetcherMetrics(),
c.compactorMetrics.getMetaFetcherMetrics(),
// List of filters to apply (order matters).
[]block.MetadataFilter{
// Remove the ingester ID because we don't shard blocks anymore, while still
// honoring the shard ID if sharding was done in the past.
NewLabelRemoverFilter([]string{cortex_tsdb.IngesterIDExternalLabel}),
block.NewConsistencyDelayMetaFilter(ulogger, c.compactorCfg.ConsistencyDelay, reg),
ignoreDeletionMarkFilter,
deduplicateBlocksFilter,
noCompactMarkerFilter,
},
filterList,
)
if err != nil {
return err
Expand Down
Loading