Skip to content

Ingester: keep queries complete after renewing tokens in several zones - #7983

Merged
yeya24 merged 1 commit into
cortexproject:masterfrom
kylestang:kyle/rebalance-fast-simple
Dec 4, 2026
Merged

yeya24 merged 1 commit into
cortexproject:masterfrom
kylestang:kyle/rebalance-fast-simple

Conversation

@kylestang

Copy link
Copy Markdown
Contributor

Renewing an ingester's tokens moves token ranges between ingesters that don't hold each other's data, so only one zone could be renewed per lookback period without queries missing data.

The ring now stores a renewed_timestamp. For the lookback period after a renewal, queries using shuffle sharding with lookback include both sides of every moved range:

  • Subrings reaching the renewed ingester's new tokens keep including the previous owners, as for a newly registered ingester.
  • Every lookback subring includes the renewed ingester, since it may still hold data of tenants whose subring it left.

The registered timestamp is left as it is. The write path and ownership shares use plain shuffle sharding and are unaffected. While a renewed ingester is unhealthy, its zone counts as failed for every tenant's reads, so queries fail rather than miss data.

The renewed timestamp is also kept in the tokens file, so it survives a restart that removes the ingester from the ring. The lifecycler updates it before the renew CAS commits, so a concurrent heartbeat can't revert it.

Older ingesters and queriers ignore the new field, so only renew in more than one zone once every component runs this version.

What this PR does:

Which issue(s) this PR fixes:
Fixes #

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

@kylestang
kylestang force-pushed the kyle/rebalance-fast-simple branch from 3fcf0b2 to b5263d3 Compare December 2, 2026 22:36
@kylestang
kylestang marked this pull request as ready for review December 2, 2026 22:37
@kylestang
kylestang requested a review from a team as a code owner December 2, 2026 22:37
Comment thread pkg/ring/ring.go Resolved
Comment thread pkg/ring/ring.go Resolved
Comment thread pkg/ring/lifecycler.go Resolved
Comment thread pkg/ring/lifecycler.go Resolved
@alanprot

alanprot commented Dec 3, 2026

Copy link
Copy Markdown
Member

Can you also add this new field on the ring_http ?

@kylestang
kylestang force-pushed the kyle/rebalance-fast-simple branch from b5263d3 to 3640511 Compare December 3, 2026 22:35
@pull-request-size pull-request-size Bot added size/XL and removed size/L labels Dec 3, 2026

@danielblando danielblando left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@kylestang
kylestang force-pushed the kyle/rebalance-fast-simple branch from 3640511 to a6a5305 Compare December 3, 2026 23:13
Renewing an ingester's tokens moves token ranges between ingesters that
don't hold each other's data, so only one zone could be renewed per
lookback period without queries missing data.

The ring now stores a renewed_timestamp. For the lookback period after a
renewal, queries using shuffle sharding with lookback include both sides
of every moved range:

- Subrings reaching the renewed ingester's new tokens keep including the
  previous owners, as for a newly registered ingester.
- Every lookback subring includes the renewed ingester, since it may
  still hold data of tenants whose subring it left.

The registered timestamp is left as it is. The write path and ownership
shares use plain shuffle sharding and are unaffected. While a renewed
ingester is unhealthy, its zone counts as failed for every tenant's
reads, so queries fail rather than miss data.

The renewed timestamp is also kept in the tokens file, so it survives a
restart that removes the ingester from the ring. The lifecycler updates
it before the renew CAS commits, so a concurrent heartbeat can't revert
it.

Older ingesters and queriers ignore the new field, so only renew in more
than one zone once every component runs this version.

Signed-off-by: Kyle Stang <kylestng@amazon.com>
@kylestang
kylestang force-pushed the kyle/rebalance-fast-simple branch from a6a5305 to 54a6247 Compare December 4, 2026 00:08
@yeya24
yeya24 merged commit 52e90f8 into cortexproject:master Dec 4, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants