Skip to content

Commit ecca5b8

Browse files
committed
Add enable delayed compaction
Signed-off-by: SungJin1212 <[email protected]>
1 parent 791ee48 commit ecca5b8

File tree

7 files changed

+20
-0
lines changed

7 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [FEATURE] Ruler: Minimize chances of missed rule group evaluations that can occur due to OOM kills, bad underlying nodes, or due to an unhealthy ruler that appears in the ring as healthy. This feature is enabled via `-ruler.enable-ha-evaluation` flag. #6129
1010
* [FEATURE] Store Gateway: Add an in-memory chunk cache. #6245
1111
* [FEATURE] Chunk Cache: Support multi level cache and add metrics. #6249
12+
* [ENHANCEMENT] Ingester: Experimental: Add `blocks-storage.tsdb.enable-delayed-compaction` to support tsdb compaction with random delay. #6284
1213
* [ENHANCEMENT] Ingester: Add `blocks-storage.tsdb.wal-compression-type` to support zstd wal compression type. #6232
1314
* [ENHANCEMENT] Query Frontend: Add info field to query response. #6207
1415
* [ENHANCEMENT] Query Frontend: Add peakSample in query stats response. #6188

docs/blocks-storage/querier.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,4 +1528,8 @@ blocks_storage:
15281528
# [EXPERIMENTAL] True to enable native histogram.
15291529
# CLI flag: -blocks-storage.tsdb.enable-native-histograms
15301530
[enable_native_histograms: <boolean> | default = false]
1531+
1532+
# [EXPERIMENTAL] True to enable delayed compaction.
1533+
# CLI flag: -blocks-storage.tsdb.enable-delayed-compaction
1534+
[enable_delayed_compaction: <boolean> | default = false]
15311535
```

docs/blocks-storage/store-gateway.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,4 +1619,8 @@ blocks_storage:
16191619
# [EXPERIMENTAL] True to enable native histogram.
16201620
# CLI flag: -blocks-storage.tsdb.enable-native-histograms
16211621
[enable_native_histograms: <boolean> | default = false]
1622+
1623+
# [EXPERIMENTAL] True to enable delayed compaction.
1624+
# CLI flag: -blocks-storage.tsdb.enable-delayed-compaction
1625+
[enable_delayed_compaction: <boolean> | default = false]
16221626
```

docs/configuration/config-file-reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,6 +2049,10 @@ tsdb:
20492049
# [EXPERIMENTAL] True to enable native histogram.
20502050
# CLI flag: -blocks-storage.tsdb.enable-native-histograms
20512051
[enable_native_histograms: <boolean> | default = false]
2052+
2053+
# [EXPERIMENTAL] True to enable delayed compaction.
2054+
# CLI flag: -blocks-storage.tsdb.enable-delayed-compaction
2055+
[enable_delayed_compaction: <boolean> | default = false]
20522056
```
20532057
20542058
### `compactor_config`

docs/configuration/v1-guarantees.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,5 @@ Currently experimental features are:
116116
- Enable string interning for metrics labels by setting `-ingester.labels-string-interning-enabled` on Ingester.
117117
- Query-frontend: query rejection (`-frontend.query-rejection.enabled`)
118118
- Querier: protobuf codec (`-api.querier-default-codec`)
119+
- Ingester: Enable TSDB compaction delay
120+
- `-blocks-storage.tsdb.enable-delayed-compaction` (boolean) CLI flag

pkg/ingester/ingester.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,7 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
21992199
OutOfOrderCapMax: i.cfg.BlocksStorageConfig.TSDB.OutOfOrderCapMax,
22002200
EnableOverlappingCompaction: false, // Always let compactors handle overlapped blocks, e.g. OOO blocks.
22012201
EnableNativeHistograms: i.cfg.BlocksStorageConfig.TSDB.EnableNativeHistograms,
2202+
EnableDelayedCompaction: i.cfg.BlocksStorageConfig.TSDB.EnableDelayedCompaction,
22022203
}, nil)
22032204
if err != nil {
22042205
return nil, errors.Wrapf(err, "failed to open TSDB: %s", udir)

pkg/storage/tsdb/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ type TSDBConfig struct {
166166

167167
// Enable native histogram ingestion.
168168
EnableNativeHistograms bool `yaml:"enable_native_histograms"`
169+
170+
// Enable deployed compaction
171+
EnableDelayedCompaction bool `yaml:"enable_delayed_compaction"`
169172
}
170173

171174
// RegisterFlags registers the TSDBConfig flags.
@@ -195,6 +198,7 @@ func (cfg *TSDBConfig) RegisterFlags(f *flag.FlagSet) {
195198
f.BoolVar(&cfg.MemorySnapshotOnShutdown, "blocks-storage.tsdb.memory-snapshot-on-shutdown", false, "True to enable snapshotting of in-memory TSDB data on disk when shutting down.")
196199
f.Int64Var(&cfg.OutOfOrderCapMax, "blocks-storage.tsdb.out-of-order-cap-max", tsdb.DefaultOutOfOrderCapMax, "[EXPERIMENTAL] Configures the maximum number of samples per chunk that can be out-of-order.")
197200
f.BoolVar(&cfg.EnableNativeHistograms, "blocks-storage.tsdb.enable-native-histograms", false, "[EXPERIMENTAL] True to enable native histogram.")
201+
f.BoolVar(&cfg.EnableDelayedCompaction, "blocks-storage.tsdb.enable-delayed-compaction", false, "[EXPERIMENTAL] True to enable delayed compaction.")
198202
}
199203

200204
// Validate the config.

0 commit comments

Comments
 (0)