diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c9fd986ee..1a45805096 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ * [BUGFIX] Querier: Fix panic due to request tracker truncating multi-byte UTF-8 character #7640 * [BUGFIX] Ingester: Fix panic (`HistogramProtoToHistogram called with a float histogram`) when ingesting a float native histogram with a zero count (e.g. a staleness marker or empty histogram). The decoder is now selected by histogram type via `IsFloatHistogram()` instead of by count value. #7645 * [BUGFIX] Querier: Fix parquet queryable fallback returning a nil error instead of the actual query error in `LabelValues` and `LabelNames`. #7638 +* [BUGFIX] Store Gateway: Fix misleading "no index cache backend addresses" validation error being reported for chunks-cache, metadata-cache, and parquet caches when their memcached or redis backend is configured without addresses. The message is now the cache-type-agnostic "no cache backend addresses". #7675 ## 1.21.0 2026-04-24 diff --git a/pkg/storage/tsdb/caching_bucket_test.go b/pkg/storage/tsdb/caching_bucket_test.go index efd25e8d62..4dcfbcc52d 100644 --- a/pkg/storage/tsdb/caching_bucket_test.go +++ b/pkg/storage/tsdb/caching_bucket_test.go @@ -75,6 +75,18 @@ func Test_BucketCacheBackendValidation(t *testing.T) { }, expectedErr: errUnsupportedBucketCacheBackend, }, + "memcached backend without addresses": { + cfg: BucketCacheBackend{ + Backend: CacheBackendMemcached, + }, + expectedErr: errNoCacheAddresses, + }, + "redis backend without addresses": { + cfg: BucketCacheBackend{ + Backend: CacheBackendRedis, + }, + expectedErr: errNoCacheAddresses, + }, "valid multi bucket cache type": { cfg: BucketCacheBackend{ Backend: fmt.Sprintf("%s,%s,%s", CacheBackendInMemory, CacheBackendMemcached, CacheBackendRedis), @@ -155,6 +167,19 @@ func Test_BucketCacheBackendValidation(t *testing.T) { } } +func Test_BucketCacheBackendValidation_MissingAddressesErrorIsGeneric(t *testing.T) { + // A bucket cache (e.g. chunks-cache) is not an index cache, so the missing + // addresses error must not mention "index cache". See issue #6804. + for _, cfg := range []BucketCacheBackend{ + {Backend: CacheBackendMemcached}, + {Backend: CacheBackendRedis}, + } { + err := cfg.Validate() + require.Error(t, err) + assert.Equal(t, "no cache backend addresses", err.Error()) + } +} + func Test_BucketIndexCache(t *testing.T) { const bucketIndexFile = "user1/bucket-index.json.gz" const fileContent = "test-content" diff --git a/pkg/storage/tsdb/index_cache.go b/pkg/storage/tsdb/index_cache.go index 7c1011f74a..2e36f312bc 100644 --- a/pkg/storage/tsdb/index_cache.go +++ b/pkg/storage/tsdb/index_cache.go @@ -41,7 +41,7 @@ var ( errUnsupportedIndexCacheBackend = errors.New("unsupported index cache backend") errDuplicatedIndexCacheBackend = errors.New("duplicated index cache backend") - errNoIndexCacheAddresses = errors.New("no index cache backend addresses") + errNoCacheAddresses = errors.New("no cache backend addresses") errInvalidMaxAsyncConcurrency = errors.New("invalid max_async_concurrency, must greater than 0") errInvalidMaxAsyncBufferSize = errors.New("invalid max_async_buffer_size, must greater than 0") errInvalidMaxBackfillItems = errors.New("invalid max_backfill_items, must greater than 0") diff --git a/pkg/storage/tsdb/index_cache_test.go b/pkg/storage/tsdb/index_cache_test.go index b0112c9c18..ae2945d9b7 100644 --- a/pkg/storage/tsdb/index_cache_test.go +++ b/pkg/storage/tsdb/index_cache_test.go @@ -31,7 +31,7 @@ func TestIndexCacheConfig_Validate(t *testing.T) { cfg: IndexCacheConfig{ Backend: "memcached", }, - expected: errNoIndexCacheAddresses, + expected: errNoCacheAddresses, }, "one memcached address should pass": { cfg: IndexCacheConfig{ diff --git a/pkg/storage/tsdb/memcache_client_config.go b/pkg/storage/tsdb/memcache_client_config.go index 239ea228bb..142e3a3588 100644 --- a/pkg/storage/tsdb/memcache_client_config.go +++ b/pkg/storage/tsdb/memcache_client_config.go @@ -46,7 +46,7 @@ func (cfg *MemcachedClientConfig) GetAddresses() []string { // Validate the config. func (cfg *MemcachedClientConfig) Validate() error { if len(cfg.GetAddresses()) == 0 { - return errNoIndexCacheAddresses + return errNoCacheAddresses } return nil diff --git a/pkg/storage/tsdb/redis_client_config.go b/pkg/storage/tsdb/redis_client_config.go index f72cc00b6a..156d622f93 100644 --- a/pkg/storage/tsdb/redis_client_config.go +++ b/pkg/storage/tsdb/redis_client_config.go @@ -67,7 +67,7 @@ func (cfg *RedisClientConfig) RegisterFlagsWithPrefix(f *flag.FlagSet, prefix st // Validate the config. func (cfg *RedisClientConfig) Validate() error { if cfg.Addresses == "" { - return errNoIndexCacheAddresses + return errNoCacheAddresses } if cfg.TLSEnabled { diff --git a/pkg/storage/tsdb/redis_client_config_test.go b/pkg/storage/tsdb/redis_client_config_test.go index 3d5c52d507..cf4d801785 100644 --- a/pkg/storage/tsdb/redis_client_config_test.go +++ b/pkg/storage/tsdb/redis_client_config_test.go @@ -18,7 +18,7 @@ func TestRedisIndexCacheConfigValidate(t *testing.T) { { name: "empty address", conf: &RedisClientConfig{}, - err: errNoIndexCacheAddresses, + err: errNoCacheAddresses, }, { name: "provide TLS cert path but not key path",