-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Move name resolution retry from managed channel to name resolver. #9758
Conversation
This change has these main aspects to it: 1. Removal of any name resolution responsibility from ManagedChannelImpl 2. Creation of a new RetryScheduler to own generic retry logic - Can also be used outside the name resolution context 3. Creation of a new RetryingNameScheduler that can be used to wrap any polling name resolver to add retry capability 4. A new facility in NameResolver to allow implementations to notify listeners on the success of name resolution attempts - RetryingNameScheduler relies on this
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.
Checkpointing review will continue tomorrow.
* @since 1.21.0 | ||
*/ | ||
public abstract void onResult(ResolutionResult resolutionResult); | ||
public abstract boolean onResult(ResolutionResult resolutionResult); |
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.
Should make sure that in release notes this change is mentioned since it breaks source-code compatibility.
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.
For sure, this will be highlighted.
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.
@ejona86 are we now not trying to provide a smoother transition?
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 strategy I had spoken to Terry about shouldn't have needed to change this boolean. In fact, the boolean right now is rather broken from a current threading and future threading perspective. Other parts of this change aren't quite right either. We should roll back.
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.
Reverting in #9767
if (scheduledHandle != null && scheduledHandle.isPending()) { | ||
return -1; | ||
} | ||
long delayNanos = policy.nextBackoffNanos(); |
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.
You might want a check to verify that it returns a positive number.
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 guess I could, but if the task can't be scheduled for some reason we would get a RejectedExecutionException which is pretty good at conveying what wen't wrong. Since the existing code to schedule retries didn't make this upfront check either, I'm thinking it's ok the way it is. Let me know if you have a stronger opinion on it.
newResolver(name, 81, GrpcUtil.NOOP_PROXY_DETECTOR, Stopwatch.createUnstarted(fakeTicker)); | ||
DnsNameResolver resolver = (DnsNameResolver) newResolver( | ||
name, 81, GrpcUtil.NOOP_PROXY_DETECTOR, | ||
Stopwatch.createUnstarted(fakeTicker)).getRetriedNameResolver(); |
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.
Why aren't you using the RetryingNameResolver for the shutdown? Seems like getting the delegate makes mistakes much easier.
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.
Good point, that would be way more precise. I updated all the tests to only use DnsNameResolver when they specifically need its API.
The
I had seen that problem earlier and had suggested to Terry to avoid it by doing the callback. It seems the approach wasn't entirely clear. What I had imagined had no new public API, but would have some private hackery between RetryingNameResolver and ManagedChannelImpl until the point we can fix the threading issues. Approach:
|
This change has these main aspects to it: