Skip to content

Conversation

@shivaspeaks
Copy link
Member

Implements server feature fail_on_data_errors, per gRFC A88: https://github.com/grpc/proposal/blob/master/A88-xds-data-error-handling.md

@shivaspeaks shivaspeaks force-pushed the server_feature_fail_on_data_errors branch from 584e614 to 342c6e1 Compare December 2, 2025 08:47
@shivaspeaks shivaspeaks marked this pull request as ready for review December 2, 2025 09:00
Copy link
Contributor

@kannanjgithub kannanjgithub left a 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;
Copy link
Contributor

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.

Copy link
Contributor

@kannanjgithub kannanjgithub left a 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
Copy link
Contributor

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;
Copy link
Contributor

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")))
Copy link
Contributor

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?

Copy link
Member Author

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.

@shivaspeaks shivaspeaks merged commit b1a94a4 into grpc:master Dec 5, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants