-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
xds/src/main/java/io/grpc/xds/XdsClusterSubscriptionRegistry.java
Outdated
Show resolved
Hide resolved
32c80c0
to
f995211
Compare
f5090ab
to
9fcbe4c
Compare
Ready for review @ejona86 |
There was a problem hiding this 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.
There was a problem hiding this 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.
1fac607
to
3f59a16
Compare
…ds aggregate and eds entries.
… as recommended by code review.
…ppearing in multiple trees or overlapping with the RDS.virtualHosts.
32a2975
to
d5dea83
Compare
There was a problem hiding this 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
|
||
|
||
private XdsWatcherBase(XdsResourceType<T> type, String resourceName) { | ||
this.type = type; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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())) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…leanUpRdsWatcher(). Let cancelWatcher remove the old RDS watcher instead of doing it explicitly in cleanUpRdsWatcher.
…related fixes and add some test utility methods for generating xds configuration.
…related fixes and add some test utility methods for generating xds configuration.
This is just defining the XdsDependencyManager and associated classes; no movement of any functionality.