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 2 commits into
base: master
Choose a base branch
from
Open

Xds fallback #11254

wants to merge 2 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
xds/src/main/java/io/grpc/xds/client/XdsClient.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java Outdated Show resolved Hide resolved
@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.

Copy link
Member

@ejona86 ejona86 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.

xds/src/main/java/io/grpc/xds/GrpcXdsTransportFactory.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
xds/src/main/java/io/grpc/xds/client/XdsClient.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/GrpcXdsTransportFactory.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
@ejona86

This comment was marked as 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
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
if (ignoreResourceDeletionEnabled && type.isFullStateOfTheWorld() && data != null) {
if (!resourceDeletionIgnored) {
logger.log(XdsLogLevel.FORCE_WARNING,
"xds server {0}: ignoring deletion for resource type {1} name {2}}",
serverInfo.target(), type, resource);
getTarget(), type, resource);
Copy link
Member

Choose a reason for hiding this comment

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

Instead of re-discovering what caused this, can we just pass ControlPlaneClient, ServerInfo, or target into onAbsent()? We have that information in the two places we call it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to get target from activeCpc.

Copy link
Member

@ejona86 ejona86 Nov 7, 2024

Choose a reason for hiding this comment

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

I don't see a reason to use activeCpc (to call getActiveCpc() at all). Why re-discover what cpc caused this? It seems easy to add the argument. Would it be a pain to update tests or something like that?

Copy link
Contributor Author

@larry-safran larry-safran left a comment

Choose a reason for hiding this comment

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

Things done in commit 003348b

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
Copy link
Member

@ejona86 ejona86 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.

xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/client/XdsClient.java Outdated Show resolved Hide resolved
xds/src/test/java/io/grpc/xds/ControlPlaneRule.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/client/XdsClient.java Outdated Show resolved Hide resolved
// try to fallback to lower priority control plane client
if (checkForFallback
&& doFallbackForAuthority(
cpcThatClosed, serverInfo, subscriber.serverInfos, subscriber.authority)) {
Copy link
Member

Choose a reason for hiding this comment

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

The docs for doFallbackForAuthority() say server info should be for the active CPC. But here it is identical to cpcThatClosed.getServerInfo().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we are only trying to do fallback for authorities for which the closed cpc was the active cpc, they are the same. However, since they are the same, and this is the only place that this method is called, there is no reason to pass the serverInfo.

authoritiesForClosedCpc = getActiveAuthorities(cpcThatClosed)
...
          if (subscriber.hasResult() || !authoritiesForClosedCpc.contains(subscriber.authority)) {
            continue;
          }

xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java Outdated Show resolved Hide resolved
Copy link
Member

@ejona86 ejona86 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.

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
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
throw new IllegalArgumentException("No xds servers found for authority " + authority);
}

for (ServerInfo serverInfo : serverInfos) {
Copy link
Member

Choose a reason for hiding this comment

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

This loop can consider cpcs that aren't currently registered for the authority, but it won't add them to activatedCpClients. That can cause activatedCpClients to be corrupted, where cpcs should be registered for the authority but aren't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the manageControlPlaneClient method that is responsible for calling addCpcToAuthority which will add the specified cpc and any missing higher priority ones. So, by the end of manageControlPlaneClient, activatedCpClients will have exactly the cpcs that it should.

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