Skip to content

Commit bffc52a

Browse files
CharlieTLeyeya24
authored andcommitted
Ingester: Add upload_compacted_blocks_enabled config to ingester to parameterize uploading compacted blocks (#5959)
In v1.15.2, ingesters configured with OOO samples ingestion enabled could hit this bug (#5402) where ingesters would not upload compacted blocks (thanos-io/thanos#6462). In v1.16.1, ingesters are configured to always upload compacted blocks (#5625). In v1.17, ingesters stopped uploading compacted blocks (#5735). This can cause problems for users upgrading from v1.15.2 with OOO ingestion enabled to v1.17 because both versions are hard coded to disable uploading compacted blocks from the ingesters. The workaround was to downgrade from v1.17 to v1.16 to allow those compacted blocks to be uploaded (and eventually deleted). The new flag is set to true by default which reverts the behavior of the ingester uploading compacted blocks back to v1.16. Signed-off-by: Charlie Le <[email protected]>
1 parent 801e16d commit bffc52a

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## 1.17.1 2024-05-20
66

77
* [CHANGE] Query Frontend/Ruler: Omit empty data, errorType and error fields in API response. #5953 #5954
8+
* [ENHANCEMENT] Ingester: Added `upload_compacted_blocks_enabled` config to ingester to parameterize uploading compacted blocks. #5959
89

910
## 1.17.0 2024-04-30
1011

docs/configuration/config-file-reference.md

+4
Original file line numberDiff line numberDiff line change
@@ -2916,6 +2916,10 @@ lifecycler:
29162916
# CLI flag: -ingester.active-series-metrics-idle-timeout
29172917
[active_series_metrics_idle_timeout: <duration> | default = 10m]
29182918
2919+
# Enable uploading compacted blocks.
2920+
# CLI flag: -ingester.upload-compacted-blocks-enabled
2921+
[upload_compacted_blocks_enabled: <boolean> | default = true]
2922+
29192923
instance_limits:
29202924
# Max ingestion rate (samples/sec) that ingester will accept. This limit is
29212925
# per-ingester, not per-tenant. Additional push requests will be rejected.

pkg/ingester/ingester.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ type Config struct {
110110
// Use blocks storage.
111111
BlocksStorageConfig cortex_tsdb.BlocksStorageConfig `yaml:"-"`
112112

113+
// UploadCompactedBlocksEnabled enables uploading compacted blocks.
114+
UploadCompactedBlocksEnabled bool `yaml:"upload_compacted_blocks_enabled"`
115+
113116
// Injected at runtime and read from the distributor config, required
114117
// to accurately apply global limits.
115118
DistributorShardingStrategy string `yaml:"-"`
@@ -143,6 +146,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
143146
f.DurationVar(&cfg.ActiveSeriesMetricsUpdatePeriod, "ingester.active-series-metrics-update-period", 1*time.Minute, "How often to update active series metrics.")
144147
f.DurationVar(&cfg.ActiveSeriesMetricsIdleTimeout, "ingester.active-series-metrics-idle-timeout", 10*time.Minute, "After what time a series is considered to be inactive.")
145148

149+
f.BoolVar(&cfg.UploadCompactedBlocksEnabled, "ingester.upload-compacted-blocks-enabled", true, "Enable uploading compacted blocks.")
146150
f.Float64Var(&cfg.DefaultLimits.MaxIngestionRate, "ingester.instance-limits.max-ingestion-rate", 0, "Max ingestion rate (samples/sec) that ingester will accept. This limit is per-ingester, not per-tenant. Additional push requests will be rejected. Current ingestion rate is computed as exponentially weighted moving average, updated every second. This limit only works when using blocks engine. 0 = unlimited.")
147151
f.Int64Var(&cfg.DefaultLimits.MaxInMemoryTenants, "ingester.instance-limits.max-tenants", 0, "Max users that this ingester can hold. Requests from additional users will be rejected. This limit only works when using blocks engine. 0 = unlimited.")
148152
f.Int64Var(&cfg.DefaultLimits.MaxInMemorySeries, "ingester.instance-limits.max-series", 0, "Max series that this ingester can hold (across all tenants). Requests to create additional series will be rejected. This limit only works when using blocks engine. 0 = unlimited.")
@@ -2107,9 +2111,7 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
21072111
func() labels.Labels { return l },
21082112
metadata.ReceiveSource,
21092113
func() bool {
2110-
// There is no need to upload compacted blocks since OOO blocks
2111-
// won't be compacted due to overlap.
2112-
return false
2114+
return i.cfg.UploadCompactedBlocksEnabled
21132115
},
21142116
true, // Allow out of order uploads. It's fine in Cortex's context.
21152117
metadata.NoneFunc,

0 commit comments

Comments
 (0)