-
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
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
…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.
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.
Apparently I didn't send these comments out yesterday. (I'm still going through it, but you can work on these in parallel.)
|
||
if (watcher instanceof CdsWatcher) { | ||
CdsWatcher cdsWatcher = (CdsWatcher) watcher; | ||
if (!cdsWatcher.parentContexts.isEmpty()) { |
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.
Do this same check for EDS?
} | ||
} | ||
|
||
addWatcher(new CdsWatcher(clusterName, parentContext, depth)); |
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.
It looks like watcher.parentContexts.put()
isn't done in this case.
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 constructor does the put so that people can't possibly forget to do it.
clusterSubscriptions.remove(clusterName); | ||
XdsWatcherBase<?> cdsWatcher = | ||
resourceWatchers.get(CLUSTER_RESOURCE).watchers.get(clusterName); | ||
cancelClusterWatcherTree((CdsWatcher) cdsWatcher, subscription.toString()); |
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.
If subscriptions.isEmpty() == false
, don't we still need to do cancelCdsWatcher()
for the watcher.parentContexts.remove(parentContext)
?
checkNotNull(subscription, "subscription"); | ||
String clusterName = subscription.getClusterName(); | ||
syncContext.execute(() -> { | ||
Set<ClusterSubscription> subscriptions = clusterSubscriptions.get(clusterName); |
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.
What value is clusterSubscriptions
providing over CdsWatcher.parentContexts
? It seems like clusterSubscriptions is just a subset of parentContexts, and stores strings. clusterSubscriptions
makes me feel better because it doesn't assume toString()/hashes are unique, but it seems the toString()/hash is load-bearing anyway. I could understand if you added a single entry to parentContexts when clusterSubscriptions for a cluster is non-empty, but that isn't being done either.
(I also don't see why parentContexts needs to store strings. It seems it could store mixed types, like both subscriptions and strings.)
…rings for cluster watcher parents.
…ject for parent. Don't send an update if the configuration hasn't changed.
This is just defining the XdsDependencyManager and associated classes; no movement of any functionality.