Skip to content

receive: make shuffle sharding stable on scale#8630

Merged
GiedriusS merged 3 commits intothanos-io:mainfrom
databricks:yuchen-db/fork-main
Jan 26, 2026
Merged

receive: make shuffle sharding stable on scale#8630
GiedriusS merged 3 commits intothanos-io:mainfrom
databricks:yuchen-db/fork-main

Conversation

@yuchen-db
Copy link
Contributor

@yuchen-db yuchen-db commented Jan 12, 2026

Fixes shuffle sharding stability when scaling ingesters. Previously, adding or removing a single node could cause tenants to be reassigned to a completely different set of nodes. Now, at most 1 node changes per tenant when scaling. Added TestShuffleShardHashringStability to verify the consistency property.

Scenario Before After
Scale 10→11, shard size 5 49% tenants >1 node change, avg 1.51 0% tenants >1 node change, avg 0.46
Scale 20→21, shard size 5 90% tenants >1 node change, avg 2.57 0% tenants >1 node change, avg 0.22
  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Verification

Signed-off-by: Yuchen Wang <yuchen.wang@databricks.com>
@yuchen-db yuchen-db force-pushed the yuchen-db/fork-main branch from 5f7de5d to dab9ac4 Compare January 12, 2026 22:32
nodes := s.Nodes()
nodesByAZ := make(map[string][]Endpoint)
for _, node := range nodes {
nodeIndexByAddr := make(map[string]int) // map address to index in nodes slice
Copy link
Member

@GiedriusS GiedriusS Jan 22, 2026

Choose a reason for hiding this comment

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

This isn't used anywhere? What was the purpose of it before?

Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

AFAICT it looks good - just some cosmetic suggestions. Thank you for your contribution 🙇

@yuchen-db
Copy link
Contributor Author

Pushed a commit to address code reviews. Thanks for taking a look.

@yuchen-db yuchen-db requested a review from GiedriusS January 23, 2026 07:57
Signed-off-by: Yuchen Wang <yuchen.wang@databricks.com>
@yuchen-db yuchen-db force-pushed the yuchen-db/fork-main branch from 0b5acaa to e7b997f Compare January 23, 2026 08:00
Signed-off-by: Yuchen Wang <yuchen.wang@databricks.com>
Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

🚀

@GiedriusS GiedriusS merged commit 8e7542a into thanos-io:main Jan 26, 2026
22 checks passed
Copy link
Contributor

@jnyi jnyi left a comment

Choose a reason for hiding this comment

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

awesome work

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.

3 participants