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

HBASE-29073 StochasticLoadBalancer has NPE potential for sumMultiplier field #136

Closed
wants to merge 3 commits into from

Conversation

rmdmattingly
Copy link

Continuing to chain PRs here. I can ship this when #135 has been shipped

@rmdmattingly rmdmattingly requested a review from ndimiduk January 14, 2025 20:47
Comment on lines +421 to +430
float localSumMultiplier = 0; // in case sumMultiplier is not initialized
for (CostFunction c : costFunctions) {
if (!c.isNeeded()) {
LOG.trace("{} not needed", c.getClass().getSimpleName());
continue;
}
total += c.cost() * c.getMultiplier();
localSumMultiplier += c.getMultiplier();
}
sumMultiplier = localSumMultiplier;
Copy link
Author

Choose a reason for hiding this comment

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

This is a small change, but sumMultiplier is initialized in balanceTable, and needsBalance is both visible to the package, and could reasonably be called before balancing. We're iterating through cost functions anyway here, we might as well have a local copy of the total multiplier

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.

1 participant