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

Xds fallback #11254

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Xds fallback #11254

wants to merge 8 commits into from

Conversation

larry-safran
Copy link
Contributor

@ejona86 ejona86 requested a review from YifeiZhuang June 17, 2024 20:49
@larry-safran larry-safran marked this pull request as ready for review June 17, 2024 20:49
Copy link
Contributor

@YifeiZhuang YifeiZhuang left a comment

Choose a reason for hiding this comment

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

This is good overall. I finally start to understand the spirit of it.

xds/src/main/java/io/grpc/xds/XdsServerWrapper.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java Outdated Show resolved Hide resolved
xds/src/test/java/io/grpc/xds/XdsClientFallbackTest.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java Outdated Show resolved Hide resolved
*/
default void assignResourcesToOwner(XdsResourceType<?> type, Collection<String> resources,
Object owner) {
// no-op - useful for test cases where everything is mocked
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:I'm confused by the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When everything is mocked there is no reason to do anything, so the cases where you want your test to implement ResourceStore you don't need to explicitly define this method that you don't want to use.

}

@Override
public void handleStreamReady(ServerInfo serverInfo) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the onReady() callback also supported by stubby xdsTransportFactory? @ejona86

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They have to have something that recognizes that a stream has come ready that can feed into these calls.

if (resources != null) {

Collection<String> resources =
resourceStore.getSubscribedResources(serverInfo, resourceType, authority);
Copy link
Contributor

@YifeiZhuang YifeiZhuang Aug 22, 2024

Choose a reason for hiding this comment

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

targetA(channelA) ----> xdsClientA resource1 (authority1) --> subscriber1 authority1 : [serverInfo1, serverInfo2] controlPlaneClient ---> serverInfo1 ---> serverInfo2 resource2 (authority2) --> subscriber2 authority2 : [serverInfo3, serverInfo4] controlPlaneClient ---> serverInfo3 ---> serverInfo4 resource3 (authority1) --> subscriber3 authority1 : [serverInfo1, serverInfo2] ---> serverInfo1 controlPlaneClient ---> serverInfo2(never happens)
targetA(channelB) ----> xdsClientB resource1 (authority1) --> subscriber1 ...

Each xdsClinet is an instance and has its own the resourceSubscriber map, and separate ads streams for it's resources.
The resources to send request for in this adstream adsStream.sendDiscoveryReuqest should be the resources with the authority the same as in this adsStream.

xds/src/main/java/io/grpc/xds/client/XdsClient.java Outdated Show resolved Hide resolved
…d completely disjoint resource names to assuming that any duplicate names would be compatible, particularly cross authority.
@larry-safran
Copy link
Contributor Author

Fallback is ready for review again.

Copy link
Contributor

@YifeiZhuang YifeiZhuang left a comment

Choose a reason for hiding this comment

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

Sending what I have, mostly minor, I haven't looked deep enough.

@Nullable
@Override
public Collection<String> getSubscribedResources(ServerInfo serverInfo,
XdsResourceType<? extends ResourceUpdate> type) {
public Collection<String> getSubscribedResources(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we simplify this method to something like this?

resources.entrySet().filter( e -> e.serverInfos.contains(serverInfo)).collect...

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 went with the authority approach instead of the ServerInfo because fallback is per authority, so you can have a situation where one authority was complete and another did fallback and requests resources, the first authority's resources would include the fallback server's ServerInfo. We don't want to get an update from the fallback server for the first authority so we don't want to request its resources.

census/src/test/java/io/grpc/census/CensusModulesTest.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java Outdated Show resolved Hide resolved
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.

3 participants