You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "urbandan (via GitHub)" <gi...@apache.org> on 2023/06/05 14:37:08 UTC
[GitHub] [kafka] urbandan opened a new pull request, #13813: KAFKA-13756: Connect validate endpoint should return proper validatio…
urbandan opened a new pull request, #13813:
URL: https://github.com/apache/kafka/pull/13813
…n response when the connector.class is missing or invalid
*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)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13756: Connect validate endpoint should return proper validatio… [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #13813: KAFKA-13756: Connect validate endpoint should return proper validatio…
URL: https://github.com/apache/kafka/pull/13813
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13756: Connect validate endpoint should return proper validatio… [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13813:
URL: https://github.com/apache/kafka/pull/13813#issuecomment-1756711573
This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please ask a committer for review. If the PR has merge conflicts, please update it with the latest from trunk (or appropriate release branch) <p> If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] urbandan commented on pull request #13813: KAFKA-13756: Connect validate endpoint should return proper validatio…
Posted by "urbandan (via GitHub)" <gi...@apache.org>.
urbandan commented on PR #13813:
URL: https://github.com/apache/kafka/pull/13813#issuecomment-1632195130
@gharris1727 No worries, thanks for taking the time to review the change!
We encountered this issue when integrating the Connect REST into an admin tool with a UI. As you mentioned, the connector.class issue results in a human-readable message, but the response cannot be properly parsed programmatically. This special handling of invalid connector.class values breaks the flow by using a different response code, and makes it hard to provide useful suggestions to the users.
The risk doesn't seem too high to me. I think the current behavior is incorrect, so fixing the API correctness outweighs the backward compatibility.
But if we stick to backward compatibility - can we add a flag (e.g. failOnInvalidClass) to the validate endpoint to specify the expected behavior around the connector.class? The default value (true) would keep the old behavior and result in a 400/500 response code, but if the client explicitly sets the flag to false, the endpoint would return a 200 response with recommendations. This way, the API itself wouldn't change, only the error message would be different (it wouldn't contain the list of available connector plugins).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] gharris1727 commented on a diff in pull request #13813: KAFKA-13756: Connect validate endpoint should return proper validatio…
Posted by "gharris1727 (via GitHub)" <gi...@apache.org>.
gharris1727 commented on code in PR #13813:
URL: https://github.com/apache/kafka/pull/13813#discussion_r1218424942
##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java:
##########
@@ -464,10 +465,22 @@ ConfigInfos validateConnectorConfig(Map<String, String> connectorProps, boolean
connectorProps = worker.configTransformer().transform(connectorProps);
}
String connType = connectorProps.get(ConnectorConfig.CONNECTOR_CLASS_CONFIG);
- if (connType == null)
- throw new BadRequestException("Connector config " + connectorProps + " contains no connector type");
+ if (connType == null) {
+ return createConnectorClassError("Config contains no connector type");
+ }
+
+ Connector connector;
+ try {
+ connector = getConnector(connType);
+ } catch (ConnectException e) {
+ return createConnectorClassError(e.getMessage());
Review Comment:
I believe this message includes a list of suggested classes. I think that the recommended values is the right way to return this data, so we may choose to omit it from the error messages thrown on this code path.
WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] urbandan commented on pull request #13813: KAFKA-13756: Connect validate endpoint should return proper validatio…
Posted by "urbandan (via GitHub)" <gi...@apache.org>.
urbandan commented on PR #13813:
URL: https://github.com/apache/kafka/pull/13813#issuecomment-1629107065
@gharris1727 Thank you for the review. At first, I was hesitant to change the exception messages, but as you mentioned, it should be easy to get the list of plugins from the REST API. Simply removed the list from the message.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] urbandan commented on pull request #13813: KAFKA-13756: Connect validate endpoint should return proper validatio…
Posted by "urbandan (via GitHub)" <gi...@apache.org>.
urbandan commented on PR #13813:
URL: https://github.com/apache/kafka/pull/13813#issuecomment-1596788032
@gharris1727 Can you please take a look at this PR? I addressed your comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13756: Connect validate endpoint should return proper validatio… [kafka]
Posted by "viktorsomogyi (via GitHub)" <gi...@apache.org>.
viktorsomogyi commented on PR #13813:
URL: https://github.com/apache/kafka/pull/13813#issuecomment-2379366673
@urbandan would you please refresh your code? I also agree with you that in this case providing a proper error response outweighs backward compatibility. Besides, 4.0 may open up a good point to merge this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] urbandan commented on a diff in pull request #13813: KAFKA-13756: Connect validate endpoint should return proper validatio…
Posted by "urbandan (via GitHub)" <gi...@apache.org>.
urbandan commented on code in PR #13813:
URL: https://github.com/apache/kafka/pull/13813#discussion_r1219366831
##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java:
##########
@@ -464,10 +465,22 @@ ConfigInfos validateConnectorConfig(Map<String, String> connectorProps, boolean
connectorProps = worker.configTransformer().transform(connectorProps);
}
String connType = connectorProps.get(ConnectorConfig.CONNECTOR_CLASS_CONFIG);
- if (connType == null)
- throw new BadRequestException("Connector config " + connectorProps + " contains no connector type");
+ if (connType == null) {
+ return createConnectorClassError("Config contains no connector type");
+ }
+
+ Connector connector;
+ try {
+ connector = getConnector(connType);
+ } catch (ConnectException e) {
+ return createConnectorClassError(e.getMessage());
Review Comment:
I agree. I was tempted to just remove the list of connectors as a whole, but there are other call sites where the exception message is logged. In case it can be useful for diagnostics, I added a parameter instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13756: Connect validate endpoint should return proper validatio… [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13813:
URL: https://github.com/apache/kafka/pull/13813#issuecomment-2846245382
This PR has been closed since it has not had any activity in 120 days. If you feel like this
was a mistake, or you would like to continue working on it, please feel free to re-open the
PR and ask for a review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13756: Connect validate endpoint should return proper validatio… [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13813:
URL: https://github.com/apache/kafka/pull/13813#issuecomment-2771264395
This PR is being marked as stale since it has not had any activity in 90 days. If you
would like to keep this PR alive, please leave a comment asking for a review. If the PR has
merge conflicts, update it with the latest from the base branch.
<p>
If you are having difficulty finding a reviewer, please reach out on the
[mailing list](https://kafka.apache.org/contact).
<p>
If this PR is no longer valid or desired, please feel free to close it. If no activity
occurs in the next 30 days, it will be automatically closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org