diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9c2e68ec..70c6042719 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,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". #PENDING ## 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..b220cd3407 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: errNoIndexCacheAddresses, + }, + "redis backend without addresses": { + cfg: BucketCacheBackend{ + Backend: CacheBackendRedis, + }, + expectedErr: errNoIndexCacheAddresses, + }, "valid multi bucket cache type": { cfg: BucketCacheBackend{ Backend: fmt.Sprintf("%s,%s,%s", CacheBackendInMemory, CacheBackendMemcached, CacheBackendRedis), @@ -155,6 +167,20 @@ 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()) + assert.NotContains(t, err.Error(), "index cache") + } +} + 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..136f5de4cd 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") + errNoIndexCacheAddresses = 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")