From d43026952989bf39a0d68ec8cd1f2d28c2aaf1cd Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Fri, 16 Jun 2023 01:29:57 -0700 Subject: [PATCH] estimate block chunk and series size from metadata (#6449) Signed-off-by: Ben Ye --- cmd/thanos/store.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/thanos/store.go b/cmd/thanos/store.go index 3865e5fbaa..4ac27ddeb3 100644 --- a/cmd/thanos/store.go +++ b/cmd/thanos/store.go @@ -366,10 +366,18 @@ func runStore( store.WithFilterConfig(conf.filterConf), store.WithChunkHashCalculation(true), store.WithSeriesBatchSize(conf.seriesBatchSize), - store.WithBlockEstimatedMaxSeriesFunc(func(_ metadata.Meta) uint64 { + store.WithBlockEstimatedMaxSeriesFunc(func(m metadata.Meta) uint64 { + if m.Thanos.IndexStats.SeriesMaxSize > 0 && + uint64(m.Thanos.IndexStats.SeriesMaxSize) < conf.estimatedMaxSeriesSize { + return uint64(m.Thanos.IndexStats.SeriesMaxSize) + } return conf.estimatedMaxSeriesSize }), - store.WithBlockEstimatedMaxChunkFunc(func(_ metadata.Meta) uint64 { + store.WithBlockEstimatedMaxChunkFunc(func(m metadata.Meta) uint64 { + if m.Thanos.IndexStats.ChunkMaxSize > 0 && + uint64(m.Thanos.IndexStats.ChunkMaxSize) < conf.estimatedMaxChunkSize { + return uint64(m.Thanos.IndexStats.ChunkMaxSize) + } return conf.estimatedMaxChunkSize }), }