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(balancer) respect the given balancer size #2747

Merged
merged 1 commit into from
Aug 31, 2017
Merged

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Jul 30, 2017

Due to a typo the configured balancer size was not set up,
and the default size of 1000 was always used.
This also fixes some of the (occasionally) failing tests.

Due to a typo the configured balancer size was not set up,
and the default size of 1000 was always used.
This fixes some of the (occasionally) failing tests.
Copy link
Member

@thibaultcha thibaultcha left a comment

Choose a reason for hiding this comment

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

LGTM 👍 but due to the comment, marking as "Hold" until 0.11.0 and 0.10.4 are out.

@@ -173,7 +173,7 @@ local get_balancer = function(target)
if not balancer then
-- no balancer yet (or invalidated) so create a new one
balancer, err = ring_balancer.new({
wheelsize = upstream.slots,
wheelSize = upstream.slots,
Copy link
Member

Choose a reason for hiding this comment

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

It seems like this value isn't used by the current version of the balancer lib:

  if (not opts.wheelSize) and opts.order then
    opts.wheelSize = #opts.order
  end
  if opts.order then
    assert(opts.order and (opts.wheelSize == #opts.order), "mismatch between size of 'order' and 'wheelSize'")
  end

From the above snippet, we can see that if wheelSize isn't given (which is the case prior to this change), then it is inferred from opts.order, which is given. Hence, while this fix is a good catch, it isn't necessary for 0.11.0 or 0.10.4 stable releases (in fact, it is slightly riskier to include it in those).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right, just double checked it. I ran into it when ripping out the orderlist property. But it seems that that change actually made this bug surface, as it was hidden by the fact that the orderlist was always given.

@thibaultcha thibaultcha added pr/ready (but hold merge) No more concerns, but do not merge yet (probably a conflict of interest with another PR or release) and removed pr/status/please review labels Jul 31, 2017
@Tieske Tieske merged commit 42962f4 into master Aug 31, 2017
@Tieske Tieske deleted the fix/balancer-size branch August 31, 2017 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/ready (but hold merge) No more concerns, but do not merge yet (probably a conflict of interest with another PR or release)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants