-
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
xdsclient: update watcher API as per gRFC A88 #7977
base: master
Are you sure you want to change the base?
Conversation
8d198b7
to
a9b45c0
Compare
4009e3e
to
57dbf23
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7977 +/- ##
==========================================
+ Coverage 82.28% 82.45% +0.17%
==========================================
Files 381 388 +7
Lines 38539 39048 +509
==========================================
+ Hits 31712 32198 +486
+ Misses 5535 5530 -5
- Partials 1292 1320 +28
|
43c9adb
to
89f475a
Compare
89f475a
to
a48b5bb
Compare
385ff44
to
1fdeb0d
Compare
// If resource is already cached, it is invoked under different error | ||
// conditions including but not limited to the following: | ||
// - resource validation error | ||
// - ADS stream failure | ||
// - connection failure |
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 also depends on a number of things like the server feature being set etc. So, I think we can get rid of this block as well. Somewhere in ResourceWatcher
documentation, we should link to A88 (probably at the top) and say that it contains an exhaustive list of what method is invoked under what conditions.
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.
Please update the documentation of the individual watchers as well based on the two comments here. Thanks.
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.
I have removed it. I have mentioned gRFC A88 at the top to refer for exhaustive list. I saw other places in code where we just mention the grfc and don't link. Also, the proposal is not merged yet.
One more i felt worth mentioning is about whether to continue reusing the existing resource or not. For OnAmbientError(), they may continue using it.
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.
The language from the gFRC is much stricter than yours:
In particular, the watcher should not stop using the previously seen resource, and the XdsClient will not remove the resource from its cache
So, please mention that the watcher should not stop using the previously seen resource
and not the watcher may continue using the previously seen resource
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.
Thanks. Updated.
@easwars ptal |
@@ -525,15 +525,16 @@ func (b *cdsBalancer) onClusterError(name string, err error) { | |||
// TRANSIENT_FAILURE. | |||
// | |||
// Only executed in the context of a serializer callback. | |||
func (b *cdsBalancer) onClusterResourceNotFound(name string) { | |||
err := xdsresource.NewErrorf(xdsresource.ErrorTypeResourceNotFound, "resource name %q of type Cluster not found in received response", name) | |||
func (b *cdsBalancer) onClusterResourceChangedError(name string, err 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.
The comment at the top of this method needs to be updated. This method now handles not only resource-not-found errors, but other types of errors as well that instruct the LB policy to stop using the previously received resource.
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. Also, updated the onClusterAmbient error to not stop using the previously seen resource
@@ -194,7 +194,7 @@ func (a *authority) handleADSStreamFailure(serverConfig *bootstrap.ServerConfig, | |||
for watcher := range state.watchers { | |||
watcher := watcher | |||
a.watcherCallbackSerializer.TrySchedule(func(context.Context) { | |||
watcher.OnError(xdsresource.NewErrorf(xdsresource.ErrorTypeConnection, "xds: error received from xDS stream: %v", err), func() {}) | |||
watcher.OnAmbientError(xdsresource.NewErrorf(xdsresource.ErrorTypeConnection, "xds: error received from xDS stream: %v", err), func() {}) |
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.
Based on the PR description, for the following two cases:
- xDS channel reports TRANSIENT_FAILURE |
- ADS stream terminates without receiving a response
the old behavior was to callOnError()
, while the new behavior is to callOnResourceChanged(status)
if resource NOT already cached, andOnAmbientError(status)
otherwise.
But, we are only calling the latter here. Am I missing something?
This came up during some other discussion with @dfawley.
|
This is the first part of implementing gRFC A88 (grpc/proposal#466).
This introduces the new watcher API but does not change any of the existing behavior. This table summarizes the API changes and behavior for each case:
OnResourceDoesNotExist()
OnResourceChanged(NOT_FOUND)
OnResourceDoesNotExist()
OnResourceChanged(NOT_FOUND)
OnError()
OnResourceChanged(status)
if resource NOT already cached;OnAmbientError(status)
otherwiseOnError()
OnResourceChanged(status)
if resource NOT already cached;OnAmbientError(status)
otherwiseOnError()
OnResourceChanged(status)
if resource NOT already cached;OnAmbientError(status)
otherwiseOnUpdate(resource)
OnResourceChanged(resource)
RELEASE NOTES: