-
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
roundrobin: Delegate subchannel creation to pickfirst #7966
Open
arjan-bal
wants to merge
11
commits into
grpc:master
Choose a base branch
from
arjan-bal:roundrobin-delegate-to-pf
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3a594f6
Update roundrobin to use endpointsharding
arjan-bal bc738b7
Revert e2e style tests
arjan-bal da80e2e
Address review comments
arjan-bal b4a9944
Add todo comments
arjan-bal 6643c1c
Merge remote-tracking branch 'source/master' into roundrobin-delegate…
arjan-bal 8f3aaf9
Merge remote-tracking branch 'source/master' into roundrobin-delegate…
arjan-bal 22a2985
merge with master
arjan-bal f688550
Re-introduce ExitIdle
arjan-bal d00fe45
Rever endpointsharding changes
arjan-bal 85682c7
Merge remote-tracking branch 'source/master' into roundrobin-delegate…
arjan-bal 84556fc
Reduce whitespace changes and make test workarounds clearer
arjan-bal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,8 +46,8 @@ | |
var err error | ||
endpointShardingLBConfig, err = endpointsharding.ParseConfig(json.RawMessage(endpointsharding.PickFirstConfig)) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
balancer.Register(builder{}) | ||
} | ||
|
||
|
@@ -59,44 +59,24 @@ | |
|
||
func (bb builder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { | ||
bal := &rrBalancer{ | ||
cc: cc, | ||
child: endpointsharding.NewBalancer(cc, opts), | ||
cc: cc, | ||
Balancer: endpointsharding.NewBalancer(cc, opts), | ||
} | ||
bal.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf("[%p] ", bal)) | ||
bal.logger.Infof("Created") | ||
return bal | ||
} | ||
|
||
type rrBalancer struct { | ||
balancer.Balancer | ||
cc balancer.ClientConn | ||
child balancer.Balancer | ||
logger *internalgrpclog.PrefixLogger | ||
} | ||
|
||
func (b *rrBalancer) Close() { | ||
b.child.Close() | ||
} | ||
|
||
func (b *rrBalancer) ExitIdle() { | ||
// Should always be ok, as child is endpoint sharding. | ||
if ei, ok := b.child.(balancer.ExitIdler); ok { | ||
ei.ExitIdle() | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still necessary, unfortunately, as only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted. |
||
|
||
func (b *rrBalancer) ResolverError(err error) { | ||
// Will cause inline picker update from endpoint sharding. | ||
b.child.ResolverError(err) | ||
} | ||
|
||
func (b *rrBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error { | ||
// Enable the health listener in pickfirst children for client side health | ||
// checks and outlier detection, if configured. | ||
ccs.ResolverState = pickfirstleaf.EnableHealthListener(ccs.ResolverState) | ||
ccs.BalancerConfig = endpointShardingLBConfig | ||
return b.child.UpdateClientConnState(ccs) | ||
} | ||
|
||
func (b *rrBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { | ||
b.logger.Errorf("UpdateSubConnState(%v, %+v) called unexpectedly", sc, state) | ||
return b.Balancer.UpdateClientConnState(ccs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 in the other PR, too.
Probably we should have
endpointsharding
produce a parsed PF config if it's going to be used frequently?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.
That's a nice idea. I've raised a PR with this change: #8007
PTAL, I'll rebase both the PRs once #8007 is merged.