Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes unaligned shards between ingesters and storage. #4087

Merged

Conversation

cyriltovena
Copy link
Contributor

Currently shards computation are not correctly aligned between ingester and storage causing bad metric results.

  • Fixed the hash calculation which was missing the metric name logs.
  • Revert some changes from 5f0e245 which was not keeping the alignement of shards.

For example if the shard is 9 of 16 total, then it should also be 9 and 25 of 32. The previous commit was trying to use 10 and 11 of 32.

/cc @owen-d @sandeepsukhani

Signed-off-by: Cyril Tovena cyril.tovena@gmail.com

Currently shards computation are not correctly aligned between ingester and storage causing bad metric results.

- Fixed the hash caculation which was missing the metric name `logs`.
- Revert some changes from grafana@5f0e245 which was not keeping the alignement of shards.

For example if the shard is 9 of 16 total, then it should also be 9 and 25 of 32. The previous commit was trying to use 10 and 11 of 32.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@cyriltovena cyriltovena requested a review from a team as a code owner August 2, 2021 14:39
Copy link
Contributor

@sandeepsukhani sandeepsukhani left a comment

Choose a reason for hiding this comment

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

Added a comment but other than that the code looks good to me!

Comment on lines -28 to -47
{32, &astmapper.ShardAnnotation{Shard: 0, Of: 16}, []uint32{0, 1}},
{32, &astmapper.ShardAnnotation{Shard: 4, Of: 16}, []uint32{8, 9}},
{32, &astmapper.ShardAnnotation{Shard: 15, Of: 16}, []uint32{30, 31}},
{64, &astmapper.ShardAnnotation{Shard: 15, Of: 16}, []uint32{60, 61, 62, 63}},

// schema factor is a larger multiple of idx factor
{16, &astmapper.ShardAnnotation{Shard: 0, Of: 32}, []uint32{0}},
{16, &astmapper.ShardAnnotation{Shard: 4, Of: 32}, []uint32{2}},
{16, &astmapper.ShardAnnotation{Shard: 15, Of: 32}, []uint32{7}},

// idx factor smaller but not a multiple of schema factor
{4, &astmapper.ShardAnnotation{Shard: 0, Of: 5}, []uint32{0}},
{4, &astmapper.ShardAnnotation{Shard: 1, Of: 5}, []uint32{0, 1}},
{4, &astmapper.ShardAnnotation{Shard: 4, Of: 5}, []uint32{3}},

// schema factor smaller but not a multiple of idx factor
{8, &astmapper.ShardAnnotation{Shard: 0, Of: 5}, []uint32{0, 1}},
{8, &astmapper.ShardAnnotation{Shard: 2, Of: 5}, []uint32{3, 4}},
{8, &astmapper.ShardAnnotation{Shard: 3, Of: 5}, []uint32{4, 5, 6}},
{8, &astmapper.ShardAnnotation{Shard: 4, Of: 5}, []uint32{6, 7}},
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have a check for Of to be a multiple of totalShards. Do we want to keep these tests or add a check for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we need those. Ingester and storage uses respectively always 16 and 32. I don't think the storage will change soon enough.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@cyriltovena cyriltovena merged commit 10bd165 into grafana:main Aug 3, 2021
cyriltovena added a commit that referenced this pull request Aug 3, 2021
* Fixes unaligned shards between ingesters and storage.

Currently shards computation are not correctly aligned between ingester and storage causing bad metric results.

- Fixed the hash caculation which was missing the metric name `logs`.
- Revert some changes from 5f0e245 which was not keeping the alignement of shards.

For example if the shard is 9 of 16 total, then it should also be 9 and 25 of 32. The previous commit was trying to use 10 and 11 of 32.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* better tests.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
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.

2 participants