KAFKA-8503: Ignore retries config if a custom timeout is provided#6913
KAFKA-8503: Ignore retries config if a custom timeout is provided#6913huxihx wants to merge 4 commits intoapache:trunkfrom
Conversation
|
@hachikuji Please review this patch. Thanks. |
|
retest this please. |
|
@hachikuji Could you take some time to review this patch? Thanks. |
|
@huxihx I wrote this KIP: https://cwiki.apache.org/confluence/display/KAFKA/KIP-533%3A+Add+default+api+timeout+to+AdminClient. Once this is approved, we can complete this work. |
|
@huxihx KIP-533 has been approved: https://cwiki.apache.org/confluence/display/KAFKA/KIP-533%3A+Add+default+api+timeout+to+AdminClient. Would you like to update this patch with the proposal? |
|
@hachikuji Please review this patch. Thanks. |
hachikuji
left a comment
There was a problem hiding this comment.
Thanks. Left a few comments. It would be helpful to have a basic unit or integration test.
| + "than 1/3 of that value. It can be adjusted even lower to control the expected time for normal rebalances."; | ||
|
|
||
| public static final String DEFAULT_API_TIMEOUT_MS_CONFIG = "default.api.timeout.ms"; | ||
| public static final String DEFAULT_API_TIMEOUT_MS_DOC = "Specifies the timeout (in milliseconds) for client APIs that could block. " + |
There was a problem hiding this comment.
We might need to generalize this description a little bit. The AdminClient APIs do not block.
There was a problem hiding this comment.
Simply dropping could block is a good option?
| */ | ||
| public Integer timeoutMs() { | ||
| return timeoutMs; | ||
| public Integer apiTimeoutMs() { |
There was a problem hiding this comment.
These changes are incompatible; we need to keep the existing API. I think it's fine to update the javadoc.
| this.defaultTimeoutMs = config.getInt(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG); | ||
| this.defaultTimeoutMs = config.getInt(AdminClientConfig.DEFAULT_API_TIMEOUT_MS_CONFIG); | ||
| // Normally, the default api timeout should be equal or larger than the request timeout. | ||
| this.requestTimeoutMs = Math.min(defaultTimeoutMs, config.getInt(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG)); |
There was a problem hiding this comment.
So our options here are either to raise an error to the user or adjust one of the configurations. Since default.api.timeout.ms is a new configuration, it is possible that a user has explicitly provided a request.timeout.ms which conflicts with the default default.api.timeout.ms. I think the logic should be something like the following:
- If a
default.api.timeout.mshas been explicitly specified, raise an error if it conflicts withrequest.timeout.ms. - If no
default.api.timeout.mshas been configured, then set its value as the max of the default andrequest.timeout.ms. Also we should probably log a warning. - Otherwise, use the provided values for both configurations.
|
retest this please. |
hachikuji
left a comment
There was a problem hiding this comment.
Thanks for the updates. Left one more comment. Note we still need test a test case which verifies basic timeout behavior.
| } | ||
| Call call = calls.remove(0); | ||
| int timeoutMs = calcTimeoutMsRemainingAsInt(now, call.deadlineMs); | ||
| int timeoutMs = Math.min(requestTimeoutMs, calcTimeoutMsRemainingAsInt(now, call.deadlineMs)); |
There was a problem hiding this comment.
In addition to passing through the timeout to createRequest, we also need to pass it through in newClientRequest. Only some of the APIs support an explicit request timeout. This appears to have been a pre-existing bug.
|
|
|
Mainly we need a test case which verifies that the config is actually respected. We don't have to do this for every API. I would say pick one and verify 1) that the default api timeout works, and 2) that it can be overridden by the Options. |
|
retest this please. |
3 similar comments
|
retest this please. |
|
retest this please. |
|
retest this please. |
|
@huxihx Do you have time to follow up here? I would like to get this merged for 2.5 if possible. |
This PR implements `default.api.timeout.ms` as documented by KIP-533. This is a rebased version of #6913 with some additional test cases and small cleanups. Reviewers: David Arthur <mumrah@gmail.com> Co-authored-by: huxi <huxi_2b@hotmail.com>
https://issues.apache.org/jira/browse/KAFKA-8503
When custom timeout is provided,
retriesconfig could be ignored for individual APIs in KafkaAdminClient. Tweaked code path forCall.failto pass NPathComplexity check.More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.
Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.
Committer Checklist (excluded from commit message)