-
Notifications
You must be signed in to change notification settings - Fork 4k
xds: implement server feature fail_on_data_errors #12544
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 server feature fail_on_data_errors #12544
Conversation
584e614 to
342c6e1
Compare
kannanjgithub
left a comment
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.
Review comments.
| // delete cached data so onError will call onResourceChanged instead of onAmbientError. | ||
| // When xdsDataErrorHandlingEnabled is false, use old behavior (always keep cached data). | ||
| boolean xdsDataErrorHandlingEnabled = | ||
| io.grpc.xds.client.BootstrapperImpl.xdsDataErrorHandlingEnabled; |
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.
Just import BootstrapperImpl and directly reference BootstrapperImpl.xdsDataErrorHandlingEnabled in the if condition.
kannanjgithub
left a comment
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.
Some comments on tests.
| * Tests that a NACKed LDS resource update drops the cached resource when fail_on_data_errors | ||
| * is enabled. | ||
| */ | ||
| @Test |
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.
We also need to test the behavior with the feature flag enabled but the server feature fail_on_data_error is false. The _subscribedResourceInvalid tests test with both these conditions false, so it should be easy to duplicate one of the tests for feature flag enabled and with the same results.
| */ | ||
| @Test | ||
| public void ldsResourceDeleted_failOnDataErrors_false() { | ||
| BootstrapperImpl.xdsDataErrorHandlingEnabled = true; |
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.
We should also test the case when this is false but the server feature is present (same results as this test).
| assertThat( | ||
| receivedStatuses.stream().anyMatch( | ||
| status -> status.getCode() == Status.Code.NOT_FOUND | ||
| && status.getDescription().contains("Resource C deleted from server"))) |
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.
Since this test already tests resource deletions, do we need the next set of tests separately for the same?
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.
By keeping both, we have simple unit tests for the individual behaviors and a more complex test for their interaction.
Implements server feature
fail_on_data_errors, per gRFC A88: https://github.com/grpc/proposal/blob/master/A88-xds-data-error-handling.md