Skip to content

Conversation

@pstibrany
Copy link
Contributor

What this PR does:

This PR simplifies internals of SpreadMinimizingTokenGenerator: it removes logger, slice with zones, parsing of instance when computing previous instance.

These changes make it easier to reuse this token generator in partitions ring code (https://github.com/grafana/dskit/compare/partitions-ring branch).

Checklist

  • Tests updated
  • [na] CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

allTokens, err := t.generateAllTokens()
if err != nil {
// we were unable to generate required tokens, so we panic.
panic(err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This panic is not new, it was just moved from generateTokensByInstanceID to this method.

Copy link
Contributor

@duricanikolic duricanikolic left a comment

Choose a reason for hiding this comment

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

LGTM
Before merging could you please check the comment I wrote?


prevInstance, err := previousInstance(t.instance)
if err != nil {
if errors.Is(err, errorNoPreviousInstance) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please check whether we still need errorNoPreviousInstance? I think that at this point it should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR removed errorNoPreviousInstance variable.

@pstibrany pstibrany merged commit 6a40f2c into main Jan 10, 2024
@pstibrany pstibrany deleted the spread-minimizing-token branch January 10, 2024 15:14
@pstibrany pstibrany mentioned this pull request Jan 10, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants