-
Notifications
You must be signed in to change notification settings - Fork 4.7k
xds: suppress the duplicate errors at the client side #9185
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
35d57a6
0e3ce43
82cbfbb
0306ac0
9db08e2
bc6a797
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,8 +376,20 @@ func (a *authority) handleADSResourceUpdate(serverConfig *ServerConfig, rType Re | |
| ServerURI: serverConfig.ServerIdentifier.ServerURI, ResourceType: rType.TypeName, | ||
| }) | ||
| } | ||
| state.md.ErrState = md.ErrState | ||
| isDuplicateErr := state.md.ErrState != nil && state.md.ErrState.Err != nil && state.md.ErrState.Err.Error() == uErr.Err.Error() | ||
| var errState *xdsresource.UpdateErrorMetadata | ||
| if md.ErrState != nil { | ||
| errState = &xdsresource.UpdateErrorMetadata{ | ||
|
Member
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. Why do we need to do this ? Can't we directly do
Contributor
Author
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.
Member
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. I dont think that is the right way to go. We should not change the error stored. We can instead compare the error in state with the ms error like :
Contributor
Author
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. We cannot compare
Then the next update brings a duplicate error for the
As an alternative I can try to check if the concatenated error in the
Contributor
Author
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. I have changed the logic to look for a duplicate resource error in the concatenated error ( |
||
| Version: md.ErrState.Version, | ||
| Err: uErr.Err, | ||
| Timestamp: md.ErrState.Timestamp, | ||
| } | ||
| } | ||
|
eshitachandwani marked this conversation as resolved.
Outdated
|
||
| state.md.ErrState = errState | ||
| state.md.Status = md.Status | ||
| if isDuplicateErr { | ||
| continue | ||
| } | ||
| for watcher := range state.watchers { | ||
| watcher := watcher | ||
| err := uErr.Err | ||
|
|
||
|
eshitachandwani marked this conversation as resolved.
|
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.
Also instead of evaluating this as a variable and then checking can we instead do the assignment first(which I assume needs to be done for either case) and then directly in an
ifblock we can evaluate the condition and callcontinueon true. WDYT ?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.
stateworks as an cache of the previously received error for the resource, so trying to find out if there was an error duplication after updatingstatewould always returntrueThere 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.
Right! but we can do the check first and if true call continue, because if we are getting the same error, we might not need to update the state? Or can the status be different ?
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 stored metadata
ErrStatemay differ, this is why we need to update it even if a duplicate error for a resource is detected. This is also the reason why the duplicate check has to be done before updating it. Please, look at the comment with an example that I made: #9185 (comment)