@@ -1024,7 +1024,8 @@ func (c *Compactor) compactUser(ctx context.Context, userID string) error {
10241024 noCompactMarkerFilter := compact .NewGatherNoCompactionMarkFilter (ulogger , bucket , c .compactorCfg .MetaSyncConcurrency )
10251025
10261026 var blockLister block.Lister
1027- switch cortex_tsdb .BlockDiscoveryStrategy (c .storageCfg .BucketStore .BlockDiscoveryStrategy ) {
1027+ blockDiscoveryStrategy := cortex_tsdb .BlockDiscoveryStrategy (c .storageCfg .BucketStore .BlockDiscoveryStrategy )
1028+ switch blockDiscoveryStrategy {
10281029 case cortex_tsdb .ConcurrentDiscovery :
10291030 blockLister = block .NewConcurrentLister (ulogger , bucket )
10301031 case cortex_tsdb .RecursiveDiscovery :
@@ -1038,6 +1039,24 @@ func (c *Compactor) compactUser(ctx context.Context, userID string) error {
10381039 return cortex_tsdb .ErrBlockDiscoveryStrategy
10391040 }
10401041
1042+ // List of filters to apply (order matters).
1043+ filterList := []block.MetadataFilter {
1044+ // Remove the ingester ID because we don't shard blocks anymore, while still
1045+ // honoring the shard ID if sharding was done in the past.
1046+ NewLabelRemoverFilter ([]string {cortex_tsdb .IngesterIDExternalLabel }),
1047+ block .NewConsistencyDelayMetaFilter (ulogger , c .compactorCfg .ConsistencyDelay , reg ),
1048+ }
1049+
1050+ // Add ignoreDeletionMarkFilter only when not using bucket index discovery.
1051+ if blockDiscoveryStrategy != cortex_tsdb .BucketIndexDiscovery {
1052+ filterList = append (filterList , ignoreDeletionMarkFilter )
1053+ }
1054+
1055+ filterList = append (filterList ,
1056+ deduplicateBlocksFilter ,
1057+ noCompactMarkerFilter ,
1058+ )
1059+
10411060 fetcher , err := block .NewMetaFetcherWithMetrics (
10421061 ulogger ,
10431062 c .compactorCfg .MetaSyncConcurrency ,
@@ -1046,16 +1065,7 @@ func (c *Compactor) compactUser(ctx context.Context, userID string) error {
10461065 c .metaSyncDirForUser (userID ),
10471066 c .compactorMetrics .getBaseFetcherMetrics (),
10481067 c .compactorMetrics .getMetaFetcherMetrics (),
1049- // List of filters to apply (order matters).
1050- []block.MetadataFilter {
1051- // Remove the ingester ID because we don't shard blocks anymore, while still
1052- // honoring the shard ID if sharding was done in the past.
1053- NewLabelRemoverFilter ([]string {cortex_tsdb .IngesterIDExternalLabel }),
1054- block .NewConsistencyDelayMetaFilter (ulogger , c .compactorCfg .ConsistencyDelay , reg ),
1055- ignoreDeletionMarkFilter ,
1056- deduplicateBlocksFilter ,
1057- noCompactMarkerFilter ,
1058- },
1068+ filterList ,
10591069 )
10601070 if err != nil {
10611071 return err
0 commit comments