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

Add new classes for eliminating xds config tears #11740

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

Conversation

larry-safran
Copy link
Contributor

@larry-safran larry-safran commented Dec 11, 2024

This is just defining the XdsDependencyManager and associated classes; no movement of any functionality.

@larry-safran larry-safran requested a review from ejona86 December 11, 2024 02:56
@larry-safran larry-safran marked this pull request as draft December 11, 2024 02:56
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.

The shape looks fine.

@larry-safran larry-safran force-pushed the XdsDependencyManager branch 2 times, most recently from f5090ab to 9fcbe4c Compare January 6, 2025 22:13
Copy link

linux-foundation-easycla bot commented Jan 7, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@larry-safran larry-safran marked this pull request as ready for review January 7, 2025 05:35
@larry-safran larry-safran requested a review from ejona86 January 7, 2025 05:35
@larry-safran
Copy link
Contributor Author

Ready for review @ejona86

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.

I still have a good amount to review. Sending what I have.

xds/src/main/java/io/grpc/xds/XdsConfig.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsConfig.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsConfig.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsConfig.java Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsDependencyManager.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsDependencyManager.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsDependencyManager.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.

Nothing really new here; just a quick drive-by. Still need to look through the other parts of the PR.

xds/src/main/java/io/grpc/xds/XdsConfig.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsConfig.java Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsConfig.java Outdated Show resolved Hide resolved
xds/src/main/java/io/grpc/xds/XdsDependencyManager.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.

Found these comments pending. Sending

xds/src/main/java/io/grpc/xds/XdsDependencyManager.java Outdated Show resolved Hide resolved


private XdsWatcherBase(XdsResourceType<T> type, String resourceName) {
this.type = type;
Copy link
Member

Choose a reason for hiding this comment

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

checkNotNull? When we store a reference for later we do ourselves a service by checking for null. Otherwise by the time the code fails with null we have lost context where the value came from.

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/src/main/java/io/grpc/xds/XdsDependencyManager.java Outdated Show resolved Hide resolved
public static final XdsClusterResource CLUSTER_RESOURCE = XdsClusterResource.getInstance();
public static final String TOP_CDS_CONTEXT = toContextStr(CLUSTER_RESOURCE.typeName(), "");
public static final XdsEndpointResource ENDPOINT_RESOURCE = XdsEndpointResource.getInstance();
private static final int MAX_CLUSTER_RECURSION_DEPTH = 16; // Matches core
Copy link
Member

Choose a reason for hiding this comment

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

s/core/c core/ (or "C++")? Core here would typically mean grpc-core, the Java code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went with C++

if (watcher instanceof CdsWatcher) {
CdsWatcher cdsWatcher = (CdsWatcher) watcher;
if (!cdsWatcher.parentContexts.isEmpty()) {
return;
Copy link
Member

Choose a reason for hiding this comment

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

throw IllegalStateException? It seems if this case is ever hit there is a bug (e.g., the wrong cancelWatcher() overload was called).

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

switch (update.clusterType()) {
case EDS:
setData(update);
if (!hasWatcher(ENDPOINT_RESOURCE, update.edsServiceName())) {
Copy link
Member

Choose a reason for hiding this comment

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

The hasWatcher() method was suspicious; it shouldn't be significant whether there was a watcher already. So I looked here, and it seems to not handle multiple parents. I agree it is unlikely that two different clusters use the same endpoint child, but that's still totally permitted and would be working today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it so that EdsWatcher keeps a list of its parents.

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