-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
balancergroup: add a ParseConfig
API and remove the UpdateBuilder
API
#7232
Conversation
// Returns a non-nil error if the provided builder is not registered. | ||
func (bg *BalancerGroup) UpdateBuilder(id, builder string) error { |
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.
You modified this to return an error, but don't check it at the call sites. Even though those used to panic, the danger is that a "normal" error will be returned from here in the future, and so not checking it is problematic.
We should either panic if the builder isn't registered (as the previous behavior) or check the error at the call sites.
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.
Removed the UpdateBuilder
call and replaced with a ParseConfig
similar to the gracefulswitch
balancer as discussed offline.
} | ||
sbc.gracefulSwitch(builder) | ||
bg.outgoingMu.Unlock() | ||
sbc.gracefulSwitch(bldr) |
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.
This used to be called without the lock -- are you sure this is OK to call with the lock held?
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.
This was called with the lock held earlier as well. Just that in the if sbc == nil
block, we were returning without releasing the lock. With the defer
now, we should release it from code paths.
logger *grpclog.PrefixLogger | ||
cc balancer.ClientConn | ||
logger *grpclog.PrefixLogger | ||
csEvltr *balancer.ConnectivityStateEvaluator |
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.
Optional, nit: how about csEval
instead? I find it much easier to say in my head.
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.
Done.
ParseConfig
API and remove the UpdateBuilder
API
@dfawley : This PR now has a totally different flavor. I was a little lazy to break it up. Let me know if you prefer that though. Thanks. |
This PR makes the following API change to the
balancergroup
package:ParseConfig
methodUpdateBuilder
methodgracefulswitch
balancerbalancergroup
that want to change the child policy for a particular child, should callParseConfig
with the new configuration, and callUpdateClientConnState
. This will result in graceful switchover to the new child policy.This PR also has a bunch of cleanup in the
clustermanager
LB policy:balancer.ConnectivityStateManager
instead of manually computing aggregate connectivity statebalancergroup
API described aboveStateAggregator
implementation inclustermanager
seems obsolete (like supporting a separatestart
method and clearing picker state inclose
).Locked
suffix to methods where appropriateRELEASE NOTES: none