Skip to content

Commit f449202

Browse files
authored
Do not use ignoreDeletionMarker filter for bucketindex lister (#7156)
* Do not use ignoreDeletionMarker filter for bucketindex lister Signed-off-by: Daniel Deluiggi <[email protected]> * changelog Signed-off-by: Daniel Deluiggi <[email protected]> --------- Signed-off-by: Daniel Deluiggi <[email protected]>
1 parent 7155ea8 commit f449202

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [ENHANCEMENT] Query Frontend: Add query priority based on operation. #7128
1616
* [ENHANCEMENT] Compactor: Avoid double compaction by cleaning partition files in 2 cycles. #7129
1717
* [ENHANCEMENT] Distributor: Optimize memory usage by recycling v2 requests. #7131
18+
* [ENHANCEMENT] Compactor: Avoid double compaction by not filtering delete blocks on real time when using bucketIndex lister. #7156
1819
* [BUGFIX] Ring: Change DynamoDB KV to retry indefinitely for WatchKey. #7088
1920
* [BUGFIX] Ruler: Add XFunctions validation support. #7111
2021
* [BUGFIX] Querier: propagate Prometheus info annotations in protobuf responses. #7132

pkg/compactor/compactor.go

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)