|
52 | 52 | errEmptyBlockranges = errors.New("empty block ranges for TSDB")
|
53 | 53 | errUnSupportedWALCompressionType = errors.New("unsupported WAL compression type, valid types are (zstd, snappy and '')")
|
54 | 54 |
|
55 |
| - ErrInvalidBucketIndexBlockDiscoveryStrategy = errors.New("bucket index block discovery strategy can only be enabled when bucket index is enabled") |
56 |
| - ErrBlockDiscoveryStrategy = errors.New("invalid block discovery strategy") |
57 |
| - ErrInvalidTokenBucketBytesLimiterMode = errors.New("invalid token bucket bytes limiter mode") |
| 55 | + ErrInvalidBucketIndexBlockDiscoveryStrategy = errors.New("bucket index block discovery strategy can only be enabled when bucket index is enabled") |
| 56 | + ErrBlockDiscoveryStrategy = errors.New("invalid block discovery strategy") |
| 57 | + ErrInvalidTokenBucketBytesLimiterMode = errors.New("invalid token bucket bytes limiter mode") |
| 58 | + ErrInvalidLazyExpandedPostingGroupMaxKeySeriesRatio = errors.New("lazy expanded posting group max key series ratio needs to be equal or greater than 0") |
58 | 59 | )
|
59 | 60 |
|
60 | 61 | // BlocksStorageConfig holds the config information for the blocks storage.
|
@@ -291,6 +292,9 @@ type BucketStoreConfig struct {
|
291 | 292 | // Controls whether lazy expanded posting optimization is enabled or not.
|
292 | 293 | LazyExpandedPostingsEnabled bool `yaml:"lazy_expanded_postings_enabled"`
|
293 | 294 |
|
| 295 | + // Controls whether expanded posting group is marked as lazy or not depending on number of keys to fetch. |
| 296 | + LazyExpandedPostingGroupMaxKeySeriesRatio float64 `yaml:"lazy_expanded_posting_group_max_key_series_ratio"` |
| 297 | + |
294 | 298 | // Controls the partitioner, used to aggregate multiple GET object API requests.
|
295 | 299 | // The config option is hidden until experimental.
|
296 | 300 | PartitionerMaxGapBytes uint64 `yaml:"partitioner_max_gap_bytes" doc:"hidden"`
|
@@ -356,6 +360,7 @@ func (cfg *BucketStoreConfig) RegisterFlags(f *flag.FlagSet) {
|
356 | 360 | f.Uint64Var(&cfg.EstimatedMaxSeriesSizeBytes, "blocks-storage.bucket-store.estimated-max-series-size-bytes", store.EstimatedMaxSeriesSize, "Estimated max series size in bytes. Setting a large value might result in over fetching data while a small value might result in data refetch. Default value is 64KB.")
|
357 | 361 | f.Uint64Var(&cfg.EstimatedMaxChunkSizeBytes, "blocks-storage.bucket-store.estimated-max-chunk-size-bytes", store.EstimatedMaxChunkSize, "Estimated max chunk size in bytes. Setting a large value might result in over fetching data while a small value might result in data refetch. Default value is 16KiB.")
|
358 | 362 | f.BoolVar(&cfg.LazyExpandedPostingsEnabled, "blocks-storage.bucket-store.lazy-expanded-postings-enabled", false, "If true, Store Gateway will estimate postings size and try to lazily expand postings if it downloads less data than expanding all postings.")
|
| 363 | + f.Float64Var(&cfg.LazyExpandedPostingGroupMaxKeySeriesRatio, "blocks-storage.bucket-store.lazy-expanded-posting-group-max-key-series-ratio", 100, "Mark posting group as lazy if it fetches more keys than R * max series the query should fetch. With R set to 100, a posting group which fetches 100K keys will be marked as lazy if the current query only fetches 1000 series. This config is only valid if lazy expanded posting is enabled. 0 disables the limit.") |
359 | 364 | f.IntVar(&cfg.SeriesBatchSize, "blocks-storage.bucket-store.series-batch-size", store.SeriesBatchSize, "Controls how many series to fetch per batch in Store Gateway. Default value is 10000.")
|
360 | 365 | f.StringVar(&cfg.BlockDiscoveryStrategy, "blocks-storage.bucket-store.block-discovery-strategy", string(ConcurrentDiscovery), "One of "+strings.Join(supportedBlockDiscoveryStrategies, ", ")+". When set to concurrent, stores will concurrently issue one call per directory to discover active blocks in the bucket. The recursive strategy iterates through all objects in the bucket, recursively traversing into each directory. This avoids N+1 calls at the expense of having slower bucket iterations. bucket_index strategy can be used in Compactor only and utilizes the existing bucket index to fetch block IDs to sync. This avoids iterating the bucket but can be impacted by delays of cleaner creating bucket index.")
|
361 | 366 | f.StringVar(&cfg.TokenBucketBytesLimiter.Mode, "blocks-storage.bucket-store.token-bucket-bytes-limiter.mode", string(TokenBucketBytesLimiterDisabled), fmt.Sprintf("Token bucket bytes limiter mode. Supported values are: %s", strings.Join(supportedTokenBucketBytesLimiterModes, ", ")))
|
@@ -390,6 +395,9 @@ func (cfg *BucketStoreConfig) Validate() error {
|
390 | 395 | if !util.StringsContain(supportedTokenBucketBytesLimiterModes, cfg.TokenBucketBytesLimiter.Mode) {
|
391 | 396 | return ErrInvalidTokenBucketBytesLimiterMode
|
392 | 397 | }
|
| 398 | + if cfg.LazyExpandedPostingGroupMaxKeySeriesRatio < 0 { |
| 399 | + return ErrInvalidLazyExpandedPostingGroupMaxKeySeriesRatio |
| 400 | + } |
393 | 401 | return nil
|
394 | 402 | }
|
395 | 403 |
|
|
0 commit comments