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

fix: range balance strategy not like reference #2245

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

njhartwell
Copy link
Contributor

@ghost ghost added the cla-needed label Jun 6, 2022
pos := float64(i)
min := int(math.Floor(pos*step + 0.5))
max := int(math.Floor((pos+1)*step + 0.5))
min := i*partitionsPerConsumer + int(math.Min(float64(consumersWithExtraPartition), float64(i)))
Copy link
Contributor Author

@njhartwell njhartwell Jun 6, 2022

Choose a reason for hiding this comment

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

The float math version is more concise, but gives different results than the reference implementation (e.g. when there are more members than available partitions, it assigns them to the middle of the list instead of the beginning).

@dnwe
Copy link
Collaborator

dnwe commented Jun 7, 2022

@njhartwell thanks for working on this. Are you happy to sign the Shopify CLA under your GitHub username?

@njhartwell
Copy link
Contributor Author

Just signed it

@ghost ghost removed the cla-needed label Jun 7, 2022
@dnwe dnwe added the fix label Jun 7, 2022
Copy link
Collaborator

@dnwe dnwe left a comment

Choose a reason for hiding this comment

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

Change looks good to me, thanks for reporting and fixing this issue!

@dnwe dnwe merged commit 23c4286 into IBM:main Jun 7, 2022
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