Skip to content

Commit 6dd44ee

Browse files
authored
estimate chunk and series size from meta.json file (#5410)
Signed-off-by: Ben Ye <[email protected]>
1 parent 2b551b6 commit 6dd44ee

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pkg/storegateway/bucket_stores.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,18 @@ func (u *BucketStores) getOrCreateStore(userID string) (*store.BucketStore, erro
481481
store.WithQueryGate(u.queryGate),
482482
store.WithChunkPool(u.chunksPool),
483483
store.WithSeriesBatchSize(store.SeriesBatchSize),
484-
store.WithBlockEstimatedMaxChunkFunc(func(_ thanos_metadata.Meta) uint64 {
484+
store.WithBlockEstimatedMaxChunkFunc(func(m thanos_metadata.Meta) uint64 {
485+
if m.Thanos.IndexStats.ChunkMaxSize > 0 &&
486+
uint64(m.Thanos.IndexStats.ChunkMaxSize) < u.cfg.BucketStore.EstimatedMaxChunkSizeBytes {
487+
return uint64(m.Thanos.IndexStats.ChunkMaxSize)
488+
}
485489
return u.cfg.BucketStore.EstimatedMaxChunkSizeBytes
486490
}),
487-
store.WithBlockEstimatedMaxSeriesFunc(func(_ thanos_metadata.Meta) uint64 {
491+
store.WithBlockEstimatedMaxSeriesFunc(func(m thanos_metadata.Meta) uint64 {
492+
if m.Thanos.IndexStats.SeriesMaxSize > 0 &&
493+
uint64(m.Thanos.IndexStats.SeriesMaxSize) < u.cfg.BucketStore.EstimatedMaxSeriesSizeBytes {
494+
return uint64(m.Thanos.IndexStats.SeriesMaxSize)
495+
}
488496
return u.cfg.BucketStore.EstimatedMaxSeriesSizeBytes
489497
}),
490498
}

0 commit comments

Comments
 (0)