-
Notifications
You must be signed in to change notification settings - Fork 28
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
(#596) Update balancer to use Placement preferred #612
Conversation
balancer/balancer.go
Outdated
const SERVER_VERSION = "v2.11.0" | ||
|
||
func checkServerVersion(nc *nats.Conn) error { | ||
version := nc.ConnectedServerVersion() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather use this and look for api level 1
Line 105 in e2f9c88
func (m *Manager) MetaApiLevel(refresh bool) (int, error) { |
We don’t know what version the meta leader is - the connection machine might be different.
API level checks talk to the machine that is jetstream leader so more reliable.
1 means 2.11
balancer/balancer.go
Outdated
return updated, err | ||
} | ||
} | ||
if apiLvl != 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check for < 1
as 2.12 might be level 2 etc, each time we add a major API change it would be incremented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Here we update the balancer to use the Placement api in 2.11. The balancer will now explicitly try to rebalance by setting the 'preferred' placement value to servers who lead less than the even distribution. We limit this functionality to server version 2.11.0 since preferred placement was not available before then.
nice one, thanks |
Here we update the balancer to use the Placement api in 2.11.
The balancer will now explicitly try to rebalance by setting the 'preferred' placement value to servers who lead less than the even distribution.
We limit this functionality to server version 2.11.0 since preferred placement was not available before then.