Repository navigation
Ring: read one DynamoDB row for self-only ingester readiness - #7984
Merged
yeya24 merged 5 commits intoDec 4, 2026
Merged
Conversation
When readiness only checks the local ingester, query DynamoDB with the ring key and the ingester ID. Use the time of that read to check heartbeat age. Keep the whole-ring read for the full readiness check and as a fallback for stores without a single-instance lookup. Exercise the query keys, fallback, and readiness decisions in unit tests. Signed-off-by: Hudson Humphries <hudsohum@amazon.com>
Signed-off-by: Hudson Humphries <hudsohum@amazon.com>
danielblando
reviewed
Dec 3, 2026
| // InstanceGetter is implemented by clients that can read one instance of a | ||
| // multi-key value, such as one member of a ring, without reading the others. | ||
| // Call it through GetInstance. | ||
| type InstanceGetter interface { |
Contributor
There was a problem hiding this comment.
I dont know if this is the best approach.
I feel this should be related to https://github.com/cortexproject/cortex/blob/master/pkg/ring/kv/codec/multikey.go#L7
Any implementation that is running with multiKey would be able to have a GetInstance call.
Maybe the kv client can check and fallback to Get if not multkey codec.
Contributor
Author
There was a problem hiding this comment.
I updated to use kv client,
- It follows how
LastUpdateTimewas added in Add dynamodb multikey kv #5026. The DynamoDB client reads the one row and decodes it withDecodeMultiKey. Consul, etcd and memberlist returnGet.InstanceGetterand the helper are gone. - I did not key it on the codec. The ring value is a
codec.MultiKeyon every store, but only DynamoDB stores one row per ID, so only the store's client can tell. GetInstancereturns no time now. The self-only check passestime.Now()toIsReadyafter the read, because a one-row read does not refreshLastUpdateTime. The other stores already returntime.Now()there.
lmk if you think it should be done a different way
Every KV client now implements GetInstance. The DynamoDB client stores a MultiKey value as one row per ID and reads the one row. Consul, etcd and memberlist keep the value as one entry and read the whole value, like Get. This replaces the optional InstanceGetter interface and the kv.GetInstance helper. GetInstance returns no time, so its signature matches Get. The self-only readiness check measures the heartbeat age from the time of the check. Signed-off-by: Hudson Humphries <hudsohum@amazon.com>
The DynamoDB client also sets LastUpdateTime after a CAS and a watch poll, not only after a read of the whole ring. A one-row read returns at most the one entry, with the type that Get returns. Signed-off-by: Hudson Humphries <hudsohum@amazon.com>
…ngle-row Conflict in CHANGELOG.md: keep both new entries. Signed-off-by: Hudson Humphries <hudsohum@amazon.com>
HudsonHumphries
added a commit
to HudsonHumphries/cortex
that referenced
this pull request
Dec 5, 2026
Brings in the self-only ingester readiness read (cortexproject#7984) and the READONLY fix for token renewal (cortexproject#7982), which merged after this branch was made.
HudsonHumphries
added a commit
to HudsonHumphries/cortex
that referenced
this pull request
Dec 5, 2026
Brings in the self-only ingester readiness read (cortexproject#7984) and the READONLY fix for token renewal (cortexproject#7982), which merged after this branch was made.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
With
-ingester.readiness-check-ring-health=false, the readiness check looks only at the instance's own ring entry. But it still reads the whole ring from the KV store to getthat entry. With the DynamoDB KV store, each readiness probe is then a Query of every row of the ring key until the instance is ready.
This PR makes that check read one row:
kv.Clientgets aGetInstancemethod. The DynamoDB client implements it with a sort-key condition on the Query, and the read does not update the ring that the clientcaches. Consul, etcd and memberlist keep the ring as one value, so they read the whole value as before.
LastUpdateTime, which can then be older, or unset, and would make an expired heartbeat look healthy.The readiness decision does not change: same entry, same state and heartbeat checks. The check with
readiness_check_ring_healthenabled still reads the whole ring.kv.Clienthas a new method, so an implementation outside this repository must add it.On a DynamoDB test table with 952 ring rows, the whole-ring read consumed 306.5 read capacity units and the one-row read 0.5.
I used an AI coding assistant for much of this change, and I reviewed and tested it.
Which issue(s) this PR fixes:
N/A
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]docs/configuration/v1-guarantees.mdupdated if this PR introduces experimental flags