-
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
cluster_resolver: wait until the configs have been propagated to all the children #7562
cluster_resolver: wait until the configs have been propagated to all the children #7562
Conversation
626ab22
to
a3da044
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7562 +/- ##
==========================================
+ Coverage 81.57% 81.82% +0.25%
==========================================
Files 354 361 +7
Lines 27076 27819 +743
==========================================
+ Hits 22088 22764 +676
- Misses 3798 3854 +56
- Partials 1190 1201 +11
|
a3da044
to
fdcdc5b
Compare
@@ -306,6 +310,11 @@ func (b *clusterResolverBalancer) run() { | |||
switch update := u.(type) { | |||
case *ccUpdate: | |||
b.handleClientConnUpdate(update) | |||
if update.done != nil { | |||
// Close the channel to convey to the consumers of updateCh | |||
// that child policies config are updated inline. |
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.
// Close the channel to signal to consumers of updateCh
// that the child policies' configuration has been updated.
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.
Updated
@@ -445,3 +446,64 @@ func (s) TestOutlierDetectionConfigPropagationToChildPolicy(t *testing.T) { | |||
t.Fatalf("Timeout when waiting for child policy to receive its configuration") | |||
} | |||
} | |||
|
|||
// Test verifies that LB waits for child policy configuration update |
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.
// TestChildPolicyConfigUpdateBlocking ensures that the load balancer
// blocks and waits for the child policy configuration to be updated
// in response to configuration changes.
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.
@aranjans need to change the comment too along with test name
|
||
// Test verifies that LB waits for child policy configuration update | ||
// inline on receipt of configuration update. | ||
func (s) TestChildPoliciesConfigUpdatedInline(t *testing.T) { |
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.
name suggestion: TestChildPolicyConfigUpdateBlocking
// Test verifies that LB waits for child policy configuration update | ||
// inline on receipt of configuration update. | ||
func (s) TestChildPoliciesConfigUpdatedInline(t *testing.T) { | ||
// Override the newConfigHook to ensure picker was updated. |
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.
// Override the ClientConnUpdateHook to track when the picker is updated.
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.
Updated
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) | ||
defer cancel() | ||
if err := managementServer.Update(ctx, resources); err != nil { | ||
t.Fatal(err) |
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.
nit: "Failed to update resources on management server: %v", err
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.
Updated
t.Fatalf("EmptyCall() failed: %v", err) | ||
} | ||
|
||
// Close the listener and ensure that the config is updated. |
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.
// Ensure that the child policy config update is processed.
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.
Updated
// Close the listener and ensure that the config is updated. | ||
lis.Close() | ||
select { | ||
case <-clientConnUpdateDone: |
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.
suggestion: can add a comment in success block // Success: config update was processed within the expected time.
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.
Updated
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
I've started an internal discussion thread to discuss what would be the correct fix for this. Please bring your thoughts to that thread. |
@easwars Should we still keep this PR open or approach will change non trivially from here? |
I think the approach will change non-trivially from here, so we can close this for now. Thanks. |
What does this PR do?
This PR ensures that every time configuration update is triggered, it waits for child policy configuration update inline.
Approach:
Added a channel to
ccUpdate
of which that channel will be closed after child policies are updated. Same is verified in the test by having aClientConnUpdateHook()
which is called after the above mentioned channel is closed, which ensures child policy was updated synchronously.RELEASE NOTES: