-
Notifications
You must be signed in to change notification settings - Fork 886
Limit calls to Conversions.resolveExecutionProfile #1623
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -535,29 +535,59 @@ public static CoordinatorException toThrowable( | |
} | ||
} | ||
|
||
/** Use {@link #resolveIdempotence(Request, DriverExecutionProfile)} instead. */ | ||
@Deprecated | ||
public static boolean resolveIdempotence(Request request, InternalDriverContext context) { | ||
return resolveIdempotence(request, resolveExecutionProfile(request, context)); | ||
} | ||
|
||
public static boolean resolveIdempotence( | ||
Request request, DriverExecutionProfile executionProfile) { | ||
Boolean requestIsIdempotent = request.isIdempotent(); | ||
DriverExecutionProfile executionProfile = resolveExecutionProfile(request, context); | ||
return (requestIsIdempotent == null) | ||
? executionProfile.getBoolean(DefaultDriverOption.REQUEST_DEFAULT_IDEMPOTENCE) | ||
: requestIsIdempotent; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This approach provides a nice optimization for callers which have already resolved the DriverExecutionProfile but it does lead to a lot of code duplication. Seems like if we pursue this path public static boolean resolveIdempotence(Request request, InternalDriverContext context) {
return resolveIdempotence(request, resolveExecutionProfile(request, context));
} Similar argument for resolveRequestTimeout() as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's worth noting that the implication of the change referenced above (and indeed this entire PR really) is that a user of this API will only see the benefit of reduced resolution of ExecutionProfiles if they use the new API; anyone using the old method Seems like at a minimum this older method should be marked as deprecated (in favor of the new one) but it doesn't seem like a huge leap from there to say if we're going to go down this path let's just remove the old method and make all callers responsible for managing DriverExecutionProfile as state. This will require some additional work; based on a quick check it looks like the DSE-specific request handlers (such as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I proposed two fixups for implementing those suggested changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since resolving an |
||
/** Use {@link #resolveRequestTimeout(Request, DriverExecutionProfile)} instead. */ | ||
@Deprecated | ||
public static Duration resolveRequestTimeout(Request request, InternalDriverContext context) { | ||
DriverExecutionProfile executionProfile = resolveExecutionProfile(request, context); | ||
return request.getTimeout() != null | ||
? request.getTimeout() | ||
return resolveRequestTimeout(request, resolveExecutionProfile(request, context)); | ||
} | ||
|
||
public static Duration resolveRequestTimeout( | ||
Request request, DriverExecutionProfile executionProfile) { | ||
Duration timeout = request.getTimeout(); | ||
return timeout != null | ||
? timeout | ||
: executionProfile.getDuration(DefaultDriverOption.REQUEST_TIMEOUT); | ||
} | ||
|
||
/** Use {@link #resolveRetryPolicy(InternalDriverContext, DriverExecutionProfile)} instead. */ | ||
@Deprecated | ||
public static RetryPolicy resolveRetryPolicy(Request request, InternalDriverContext context) { | ||
DriverExecutionProfile executionProfile = resolveExecutionProfile(request, context); | ||
return context.getRetryPolicy(executionProfile.getName()); | ||
} | ||
|
||
public static RetryPolicy resolveRetryPolicy( | ||
InternalDriverContext context, DriverExecutionProfile executionProfile) { | ||
return context.getRetryPolicy(executionProfile.getName()); | ||
} | ||
|
||
/** | ||
* Use {@link #resolveSpeculativeExecutionPolicy(InternalDriverContext, DriverExecutionProfile)} | ||
* instead. | ||
*/ | ||
@Deprecated | ||
public static SpeculativeExecutionPolicy resolveSpeculativeExecutionPolicy( | ||
chibenwa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Request request, InternalDriverContext context) { | ||
DriverExecutionProfile executionProfile = resolveExecutionProfile(request, context); | ||
return context.getSpeculativeExecutionPolicy(executionProfile.getName()); | ||
} | ||
|
||
public static SpeculativeExecutionPolicy resolveSpeculativeExecutionPolicy( | ||
InternalDriverContext context, DriverExecutionProfile executionProfile) { | ||
return context.getSpeculativeExecutionPolicy(executionProfile.getName()); | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.