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
xds: implement the top-level LB policy #7203
xds: implement the top-level LB policy #7203
Conversation
…and implement the config parser.
…oup of child balancers to the Channel when handleResolvedAddresses is invoked.
…LE instead of INTERNAL error.
0a0960a
to
bcabf09
Compare
class ClusterManagerLoadBalancer extends LoadBalancer { | ||
|
||
@VisibleForTesting | ||
static final int DELAYED_ACTION_DELETION_TIME_MINUTES = 15; |
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.
_ACTION_
?
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.
Oops. Fixed.
|
||
@Override | ||
public void updateBalancingState(ConnectivityState newState, SubchannelPicker newPicker) { | ||
if (deactivated) { |
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.
Even if deactivated, should still update currentState
and currentPicker
, just not updateOverallBalancingState()
(already guaranteed). The XdsRoutingLoadBalancer
has the same issue.
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.
Good point. Fixed here.
this.helper = checkNotNull(helper, "helper"); | ||
this.syncContext = checkNotNull(helper.getSynchronizationContext(), "syncContext"); | ||
this.timeService = checkNotNull(helper.getScheduledExecutorService(), "timeService"); | ||
logger = XdsLogger.withLogId(InternalLogId.allocate("cds-lb", helper.getAuthority())); |
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.
cds-lb?
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.
Fixed.
syncContext.execute(new Runnable() { | ||
@Override | ||
public void run() { | ||
childLbStates.get(name).lb.handleResolvedAddresses(childAddresses); |
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.
Declare variable for childLbStates.get(name)
ahead of syncContext.execute()
, otherwise childLbStates
might have been mutated when `syncContext.execute() in extreme case.
Or just run childLbStates.get(name).lb.handleResolvedAddresses(childAddresses)
inline at the end of this method.
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.
Good point, this turns out to be a programming practice. Thanks. Fixed. Will change it in XdsRoutingLoadBalancer as well (although it will go away after XdsConfigSelector, we want it to be correct in the release).
…ts config is updated in the parent balancer.
The top-level LB policy, which is an aggregator for CDS policies. It maintains the lifecycle of CDS LB policy instances. The pick argument taken from the Channel contains the information to determine which child CDS policy instance should the picking operation be delegated to. The implementation is similar to the action part of what we currently have in the routing policy. The existing routing policy will be refactored to two parts, with the route match part moved into ConfigSelector and action part being this top-level LB policy.
The top-level LB policy, which is an aggregator for CDS policies. It maintains the lifecycle of CDS LB policy instances. The pick argument taken from the Channel contains the information to determine which child CDS policy instance should the picking operation be delegated to.
The implementation is similar to the action part of what we currently have in the routing policy. The existing routing policy will be refactored to two parts, with the route match part moved into ConfigSelector and action part being this top-level LB policy.