Skip to content

Make missing cache-address validation error generic across cache types#7675

Open
anxkhn wants to merge 1 commit into
cortexproject:masterfrom
anxkhn:fix/generic-cache-addresses-error
Open

Make missing cache-address validation error generic across cache types#7675
anxkhn wants to merge 1 commit into
cortexproject:masterfrom
anxkhn:fix/generic-cache-addresses-error

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 6, 2026

Copy link
Copy Markdown

What this PR does:

Fixes a misleading validation error. The shared error errNoIndexCacheAddresses
reads no index cache backend addresses, but the memcached and redis client-config
validators that return it are also used by the bucket caches (chunks-cache,
metadata-cache, and the parquet caches) via BucketCacheBackend, not just the index
cache. Configuring one of those with a memcached or redis backend but no addresses
therefore reports the wrong cache type, for example:

error validating config: invalid TSDB config: chunks-cache configuration: no index cache backend addresses

The wrapping prefix produced by BucketStoreConfig.Validate already names the cache
type (chunks-cache configuration:, metadata-cache configuration:, etc.), so this
drops the incorrect index qualifier from the message. It now reads:

error validating config: invalid TSDB config: chunks-cache configuration: no cache backend addresses

The index-cache path keeps a correct message because its own prefix still names it.
A regression test is added for the bucket-cache path asserting the message is generic
and does not contain index cache.

Change is message-only: no control flow or behavior changes. All four references to
errNoIndexCacheAddresses use it by value, so the variable name is left unchanged to
avoid unrelated churn.

Which issue(s) this PR fixes:
Fixes #6804

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
  • docs/configuration/v1-guarantees.md updated if this PR introduces experimental flags

Notes for the maintainer / reviewer (optional, can trim)

  • The reporter suggested "memcached backend address"; I chose the broader
    "no cache backend addresses" because the same error var is shared by both the
    memcached AND redis validators across all cache types, and the prefix from
    BucketStoreConfig.Validate already identifies which cache. This keeps a single
    message correct for every path.
  • CHANGELOG entry uses the Store Gateway: component prefix (the store-gateway is
    what consumes these bucket caches); happy to switch to Storage/Blocks storage
    if you prefer.

CHANGELOG note (post-open bookkeeping)

The CHANGELOG line ends with the #PENDING placeholder. Per repo convention the
trailing #NNNN is the PR number, so after the PR is opened, edit that entry to the
real PR number and push the amend. (The issue is linked via Fixes #6804 in the body,
not in the CHANGELOG.)

The shared errNoIndexCacheAddresses said "no index cache backend
addresses", but the memcached and redis client-config validators that
return it are also used by chunks-cache, metadata-cache, and the parquet
caches via BucketCacheBackend. Configuring one of those with a memcached
or redis backend but no addresses produced a misleading error, e.g.
"chunks-cache configuration: no index cache backend addresses".

The wrapping prefix in BucketStoreConfig.Validate already names the cache
type, so drop the incorrect "index" qualifier from the message. Add
regression coverage for the bucket-cache path.

Fixes cortexproject#6804

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@dosubot dosubot Bot added the type/bug label Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong error message when using chunks cache with memcached

1 participant