Skip to content
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

csds: update xds_client to populate update metadata #4226

Merged
merged 7 commits into from Mar 4, 2021

Conversation

menghanl
Copy link
Contributor

  • xds_client.go
    • populate Metadata for the update
    • When unmarshalling responses, DON'T stop at the first error. Keep processing
      all the resources, so we know which resources are NACKed.
  • v2/v3 client.go
    • Send the updates to client_callback.go even when response is NACKed. This is
      necessary for CSDS's purpose, and also necessary when we later call user's
      callback with the NACK errors.
  • Test changes

xds/internal/client/xds.go Outdated Show resolved Hide resolved
xds/internal/client/client_test.go Outdated Show resolved Hide resolved
xds/internal/client/cds_test.go Show resolved Hide resolved
xds/internal/client/xds.go Show resolved Hide resolved
xds/internal/client/cds_test.go Outdated Show resolved Hide resolved
}
if diff := cmp.Diff(update, test.wantUpdate, cmpOpts); diff != "" {
t.Errorf("UnmarshalCluster(%v) = %v want %v", test.resources, update, test.wantUpdate)
t.Errorf(diff)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just printing the diff with the (-got, +want) should be good enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

xds/internal/client/cds_test.go Outdated Show resolved Hide resolved
xds/internal/client/v2/cds_test.go Outdated Show resolved Hide resolved
@easwars easwars assigned menghanl and unassigned easwars Mar 2, 2021
@menghanl menghanl force-pushed the csds_client_unmarshal_change branch from ec30725 to 1815134 Compare March 2, 2021 21:59
if (err != nil) != (test.wantErr != "") {
t.Fatalf("UnmarshalListener(%v) = %v wantErr: %q", test.resources, err, test.wantErr)
t.Errorf("UnmarshalListener(), got err: %v, wantErr: %v", err, test.wantErr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this to Errorf()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the resource is NACK'ed, we still want to check the content in the update and metadata.

  • update contains the resource names, so we know what was in the response
  • metadata contains the resource version, and errors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, actually, that's a different thing.
Maybe this should stay Fatal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change wasn't intentional. But it seems to be OK to Error instead of Fatal. I'm going to keep it this way. Let me know if you think otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that we are using Error instead of Fatal in TestUnmarshalListener_ClientSide as well. But I don't see how useful a diff of the update or the metadata is going to be when the gotErr != wantErr.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the error check to Fatal. Kept the following checks as Error. It could be useful to compare metadata even if returned update is different.

xds/internal/client/xds.go Outdated Show resolved Hide resolved
…date metadata

xds_client.go
 - populate Metadata for the update
 - When unmarshalling responses, DON'T stop at the first error. Keep processing
   all the resources, so we know which resources are NACKed.
v2/v3 client.go
 - Send the updates to client_callback.go even when response is NACKed. This is
   necessary for CSDS's purpose, and also necessary when we later call user's
   callback with the NACK errors.
Test changes
@menghanl menghanl force-pushed the csds_client_unmarshal_change branch from b51a518 to 84b74aa Compare March 4, 2021 01:44
@menghanl menghanl merged commit 930c791 into grpc:master Mar 4, 2021
@menghanl menghanl deleted the csds_client_unmarshal_change branch March 4, 2021 02:06
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants