Skip to content

Commit 88437c8

Browse files
GiedriusSyuchen-db
authored andcommitted
cherry pick upstream pr 7914
1 parent 59f5c54 commit 88437c8

File tree

9 files changed

+821
-23
lines changed

9 files changed

+821
-23
lines changed

cmd/thanos/receive.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ func runReceive(
143143

144144
level.Info(logger).Log("mode", receiveMode, "msg", "running receive")
145145

146-
multiTSDBOptions := []receive.MultiTSDBOption{}
146+
multiTSDBOptions := []receive.MultiTSDBOption{
147+
receive.WithHeadExpandedPostingsCacheSize(conf.headExpandedPostingsCacheSize),
148+
receive.WithBlockExpandedPostingsCacheSize(conf.compactedBlocksExpandedPostingsCacheSize),
149+
}
147150
for _, feature := range *conf.featureList {
148151
if feature == metricNamesFilter {
149152
multiTSDBOptions = append(multiTSDBOptions, receive.WithMetricNameFilterEnabled())
@@ -1003,6 +1006,9 @@ type receiveConfig struct {
10031006
maxPendingGrpcWriteRequests int
10041007

10051008
featureList *[]string
1009+
1010+
headExpandedPostingsCacheSize uint64
1011+
compactedBlocksExpandedPostingsCacheSize uint64
10061012
}
10071013

10081014
func (rc *receiveConfig) registerFlag(cmd extkingpin.FlagClause) {
@@ -1115,6 +1121,9 @@ func (rc *receiveConfig) registerFlag(cmd extkingpin.FlagClause) {
11151121

11161122
cmd.Flag("tsdb.no-lockfile", "Do not create lockfile in TSDB data directory. In any case, the lockfiles will be deleted on next startup.").Default("false").BoolVar(&rc.noLockFile)
11171123

1124+
cmd.Flag("tsdb.head.expanded-postings-cache-size", "[EXPERIMENTAL] If non-zero, enables expanded postings cache for the head block.").Default("0").Uint64Var(&rc.headExpandedPostingsCacheSize)
1125+
cmd.Flag("tsdb.block.expanded-postings-cache-size", "[EXPERIMENTAL] If non-zero, enables expanded postings cache for compacted blocks.").Default("0").Uint64Var(&rc.compactedBlocksExpandedPostingsCacheSize)
1126+
11181127
cmd.Flag("tsdb.max-exemplars",
11191128
"Enables support for ingesting exemplars and sets the maximum number of exemplars that will be stored per tenant."+
11201129
" In case the exemplar storage becomes full (number of stored exemplars becomes equal to max-exemplars),"+

docs/components/receive.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,12 @@ Flags:
552552
Allow overlapping blocks, which in turn enables
553553
vertical compaction and vertical query merge.
554554
Does not do anything, enabled all the time.
555+
--tsdb.block.expanded-postings-cache-size=0
556+
[EXPERIMENTAL] If non-zero, enables expanded
557+
postings cache for compacted blocks.
558+
--tsdb.head.expanded-postings-cache-size=0
559+
[EXPERIMENTAL] If non-zero, enables expanded
560+
postings cache for the head block.
555561
--tsdb.max-exemplars=0 Enables support for ingesting exemplars and
556562
sets the maximum number of exemplars that will
557563
be stored per tenant. In case the exemplar

0 commit comments

Comments
 (0)