Skip to content

Commit cb4633e

Browse files
authored
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 <charlie_le@apple.com>
1 parent c731037 commit cb4633e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* [ENHANCEMENT] KV: Etcd Added etcd.ping-without-stream-allowed parameter to disable/enable PermitWithoutStream #5933
1111
* [ENHANCEMENT] Ingester: Add a new `max_series_per_label_set` limit. This limit functions similarly to `max_series_per_metric`, but allowing users to define the maximum number of series per LabelSet. #5950
1212
* [ENHANCEMENT] Store Gateway: Log gRPC requests together with headers configured in `http_request_headers_to_log`. #5958
13+
* [ENHANCEMENT] Ingester: Added `upload_compacted_blocks_enabled` config to ingester to parameterize uploading compacted blocks.
1314
* [CHANGE] Upgrade Dockerfile Node version from 14x to 18x. #5906
1415
* [CHANGE] Query Frontend/Ruler: Omit empty data field in API response. #5953 #5954
1516
* [BUGFIX] Configsdb: Fix endline issue in db password. #5920

docs/configuration/config-file-reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,6 +2928,10 @@ lifecycler:
29282928
# CLI flag: -ingester.active-series-metrics-idle-timeout
29292929
[active_series_metrics_idle_timeout: <duration> | default = 10m]
29302930
2931+
# Enable uploading compacted blocks.
2932+
# CLI flag: -ingester.upload-compacted-blocks-enabled
2933+
[upload_compacted_blocks_enabled: <boolean> | default = true]
2934+
29312935
instance_limits:
29322936
# Max ingestion rate (samples/sec) that ingester will accept. This limit is
29332937
# per-ingester, not per-tenant. Additional push requests will be rejected.

pkg/ingester/ingester.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ type Config struct {
111111
// Use blocks storage.
112112
BlocksStorageConfig cortex_tsdb.BlocksStorageConfig `yaml:"-"`
113113

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

150+
f.BoolVar(&cfg.UploadCompactedBlocksEnabled, "ingester.upload-compacted-blocks-enabled", true, "Enable uploading compacted blocks.")
147151
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.")
148152
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.")
149153
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.")
@@ -2138,9 +2142,7 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
21382142
func() labels.Labels { return l },
21392143
metadata.ReceiveSource,
21402144
func() bool {
2141-
// There is no need to upload compacted blocks since OOO blocks
2142-
// won't be compacted due to overlap.
2143-
return false
2145+
return i.cfg.UploadCompactedBlocksEnabled
21442146
},
21452147
true, // Allow out of order uploads. It's fine in Cortex's context.
21462148
metadata.NoneFunc,

0 commit comments

Comments
 (0)