diff --git a/pkg/storage/stores/shipper/bloomshipper/config/config.go b/pkg/storage/stores/shipper/bloomshipper/config/config.go index de1ad3a12034..be4d96c765e1 100644 --- a/pkg/storage/stores/shipper/bloomshipper/config/config.go +++ b/pkg/storage/stores/shipper/bloomshipper/config/config.go @@ -17,6 +17,10 @@ type Config struct { DownloadParallelism int `yaml:"download_parallelism"` BlocksCache BlocksCacheConfig `yaml:"blocks_cache"` MetasCache cache.Config `yaml:"metas_cache"` + + // This will always be set to true when flags are registered. + // In tests, where config is created as literal, it can be set manually. + CacheListOps bool `yaml:"-"` } func (c *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { @@ -27,6 +31,9 @@ func (c *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { f.IntVar(&c.DownloadParallelism, prefix+"download-parallelism", 16, "The amount of maximum concurrent bloom blocks downloads.") c.BlocksCache.RegisterFlagsWithPrefixAndDefaults(prefix+"blocks-cache.", "Cache for bloom blocks. ", f, 24*time.Hour) c.MetasCache.RegisterFlagsWithPrefix(prefix+"metas-cache.", "Cache for bloom metas. ", f) + + // always cache LIST operations + c.CacheListOps = true } func (c *Config) Validate() error { diff --git a/pkg/storage/stores/shipper/bloomshipper/store.go b/pkg/storage/stores/shipper/bloomshipper/store.go index 7d5b4df178b9..5e1363d0cb73 100644 --- a/pkg/storage/stores/shipper/bloomshipper/store.go +++ b/pkg/storage/stores/shipper/bloomshipper/store.go @@ -295,7 +295,9 @@ func NewBloomStore( return nil, errors.Wrapf(err, "creating object client for period %s", periodicConfig.From) } - objectClient = newCachedListOpObjectClient(objectClient, 5*time.Minute, 10*time.Second) + if storageConfig.BloomShipperConfig.CacheListOps { + objectClient = newCachedListOpObjectClient(objectClient, 5*time.Minute, 10*time.Second) + } bloomClient, err := NewBloomClient(cfg, objectClient, logger) if err != nil { return nil, errors.Wrapf(err, "creating bloom client for period %s", periodicConfig.From)