Skip to content

Commit 3497d6a

Browse files
authored
Exposing Thanos accept-malformed-index to Cortex compactor (#5334)
* Exposing Thanos accept-malformed-index to Cortex compactor Signed-off-by: Alex Le <leqiyue@amazon.com> * updated changelog Signed-off-by: Alex Le <leqiyue@amazon.com> --------- Signed-off-by: Alex Le <leqiyue@amazon.com>
1 parent db90ad2 commit 3497d6a

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [FEATURE] Store Gateway: Add `max_downloaded_bytes_per_request` to limit max bytes to download per store gateway request.
99
* [ENHANCEMENT] Support object storage backends for runtime configuration file. #5292
1010
* [ENHANCEMENT] Query Frontend: Reject subquery with too small step size. #5323
11+
* [ENHANCEMENT] Compactor: Exposing Thanos accept-malformed-index to Cortex compactor. #5334
1112
* [BUGFIX] Ruler: Validate if rule group can be safely converted back to rule group yaml from protobuf message #5265
1213
* [BUGFIX] Querier: Convert gRPC `ResourceExhausted` status code from store gateway to 422 limit error. #5286
1314
* [BUGFIX] Alertmanager: Route web-ui requests to the alertmanager distributor when sharding is enabled. #5293

docs/blocks-storage/compactor.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,8 @@ compactor:
277277
# compaction.
278278
# CLI flag: -compactor.block-visit-marker-file-update-interval
279279
[block_visit_marker_file_update_interval: <duration> | default = 1m]
280+
281+
# When enabled, index verification will ignore out of order label names.
282+
# CLI flag: -compactor.accept-malformed-index
283+
[accept_malformed_index: <boolean> | default = false]
280284
```

docs/configuration/config-file-reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,10 @@ sharding_ring:
19291929
# How frequently block visit marker file should be updated duration compaction.
19301930
# CLI flag: -compactor.block-visit-marker-file-update-interval
19311931
[block_visit_marker_file_update_interval: <duration> | default = 1m]
1932+
1933+
# When enabled, index verification will ignore out of order label names.
1934+
# CLI flag: -compactor.accept-malformed-index
1935+
[accept_malformed_index: <boolean> | default = false]
19321936
```
19331937

19341938
### `configs_config`

pkg/compactor/compactor.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ var (
5656
return compact.NewDefaultGrouper(
5757
logger,
5858
bkt,
59-
false, // Do not accept malformed indexes
60-
true, // Enable vertical compaction
59+
cfg.AcceptMalformedIndex,
60+
true, // Enable vertical compaction
6161
reg,
6262
blocksMarkedForDeletion,
6363
garbageCollectedBlocks,
@@ -72,8 +72,8 @@ var (
7272
ctx,
7373
logger,
7474
bkt,
75-
false, // Do not accept malformed indexes
76-
true, // Enable vertical compaction
75+
cfg.AcceptMalformedIndex,
76+
true, // Enable vertical compaction
7777
reg,
7878
blocksMarkedForDeletion,
7979
blocksMarkedForNoCompaction,
@@ -208,6 +208,8 @@ type Config struct {
208208
// Block visit marker file config
209209
BlockVisitMarkerTimeout time.Duration `yaml:"block_visit_marker_timeout"`
210210
BlockVisitMarkerFileUpdateInterval time.Duration `yaml:"block_visit_marker_file_update_interval"`
211+
212+
AcceptMalformedIndex bool `yaml:"accept_malformed_index"`
211213
}
212214

213215
// RegisterFlags registers the Compactor flags.
@@ -244,6 +246,8 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
244246

245247
f.DurationVar(&cfg.BlockVisitMarkerTimeout, "compactor.block-visit-marker-timeout", 5*time.Minute, "How long block visit marker file should be considered as expired and able to be picked up by compactor again.")
246248
f.DurationVar(&cfg.BlockVisitMarkerFileUpdateInterval, "compactor.block-visit-marker-file-update-interval", 1*time.Minute, "How frequently block visit marker file should be updated duration compaction.")
249+
250+
f.BoolVar(&cfg.AcceptMalformedIndex, "compactor.accept-malformed-index", false, "When enabled, index verification will ignore out of order label names.")
247251
}
248252

249253
func (cfg *Config) Validate(limits validation.Limits) error {

pkg/compactor/shuffle_sharding_grouper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ mainLoop:
249249
groupKey,
250250
externalLabels,
251251
resolution,
252-
false, // No malformed index.
253-
true, // Enable vertical compaction.
252+
g.acceptMalformedIndex,
253+
true, // Enable vertical compaction.
254254
g.compactions.WithLabelValues(groupKey),
255255
g.compactionRunsStarted.WithLabelValues(groupKey),
256256
g.compactionRunsCompleted.WithLabelValues(groupKey),

0 commit comments

Comments
 (0)