Fixed documentation and handles null topicPartition for KAFKA-12841#11689
Merged
cmccabe merged 10 commits intoapache:trunkfrom Feb 3, 2022
Merged
Fixed documentation and handles null topicPartition for KAFKA-12841#11689cmccabe merged 10 commits intoapache:trunkfrom
cmccabe merged 10 commits intoapache:trunkfrom
Conversation
…e of ApiException Using the InterceptorCallback wrapper in the case of ApiException so that we will adhere correctly to the Callback contract for onCompletion specifying a valid (dummy) TopicPartition.
update documentation
when metadata null, all fields are -1
cmccabe
reviewed
Jan 20, 2022
cmccabe
reviewed
Jan 20, 2022
cmccabe
reviewed
Jan 20, 2022
| try { | ||
| assertNotNull(recordMetadata.topic()); | ||
| } catch (NullPointerException e) { | ||
| fail("Topic name should be valid even on send failure", e); |
Contributor
There was a problem hiding this comment.
It's not necessary to do this. If you want to display a special error message when the assert fails, there is a three-argument form which lets you specify the error message.
cmccabe
reviewed
Jan 20, 2022
- specify topicPartition behavior - method naming - use 2 params assert to display proper error messages
Closed
3 tasks
cmccabe
reviewed
Feb 2, 2022
Contributor
|
test failures are not related. |
cmccabe
pushed a commit
that referenced
this pull request
Feb 3, 2022
…#11689) Sometimes, the Kafka producer encounters an error prior to selecting a topic partition. In this case, we would like to acknowledge the failure in the producer interceptors, if any are configured. We should also pass a non-null Metadata object to the producer callback, if there is one. This PR implements that behavior. It also updates the JavaDoc to clarify that if a partition cannot be selected, we will pass back a partition id of -1 in the metadata. This is in keeping with KAFKA-3303. Co-authors: Kirk True <kirk@mustardgrain.com> Reviewers: Colin P. McCabe <cmccabe@apache.org>
cmccabe
pushed a commit
that referenced
this pull request
Feb 3, 2022
…#11689) Sometimes, the Kafka producer encounters an error prior to selecting a topic partition. In this case, we would like to acknowledge the failure in the producer interceptors, if any are configured. We should also pass a non-null Metadata object to the producer callback, if there is one. This PR implements that behavior. It also updates the JavaDoc to clarify that if a partition cannot be selected, we will pass back a partition id of -1 in the metadata. This is in keeping with KAFKA-3303. Co-authors: Kirk True <kirk@mustardgrain.com> Reviewers: Colin P. McCabe <cmccabe@apache.org>
3 tasks
junrao
reviewed
Apr 18, 2022
Contributor
junrao
left a comment
There was a problem hiding this comment.
@philipnee : Thanks for the PR. Added a comment below.
|
|
||
| // The onCompletion callback does expect a non-null metadata, but one will be created inside | ||
| // the interceptor's onCompletion implementation before the user's callback is invoked. | ||
| interceptCallback.onCompletion(null, e); |
Contributor
There was a problem hiding this comment.
@philipnee : It seems that we may have introduced a bug here. interceptors.onAcknowledgement() is now called twice, once through interceptCallback.onCompletion() and another through interceptors.onSendError() in line 1010 below.
Contributor
Author
This was referenced Apr 18, 2022
junrao
pushed a commit
that referenced
this pull request
Apr 25, 2022
The bug was introduced in #11689 that an additional onAcknowledgement was made using the InterceptorCallback class. This is undesirable since onSendError will attempt to call onAcknowledgement once more. Reviewers: Jun Rao <junrao@gmail.com>
cadonna
pushed a commit
that referenced
this pull request
Apr 27, 2022
The bug was introduced in #11689 that an additional onAcknowledgement was made using the InterceptorCallback class. This is undesirable since onSendError will attempt to call onAcknowledgement once more. Reviewers: Jun Rao <junrao@gmail.com>
jeffkbkim
pushed a commit
to confluentinc/kafka
that referenced
this pull request
May 12, 2022
…apache#11689) Sometimes, the Kafka producer encounters an error prior to selecting a topic partition. In this case, we would like to acknowledge the failure in the producer interceptors, if any are configured. We should also pass a non-null Metadata object to the producer callback, if there is one. This PR implements that behavior. It also updates the JavaDoc to clarify that if a partition cannot be selected, we will pass back a partition id of -1 in the metadata. This is in keeping with KAFKA-3303. Co-authors: Kirk True <kirk@mustardgrain.com> Reviewers: Colin P. McCabe <cmccabe@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: https://issues.apache.org/jira/browse/KAFKA-12841
Using the
InterceptorCallbackwrapper in the case ofApiExceptionso that we will adhere correctly to theCallbackcontract foronCompletionspecifying a valid (dummy)TopicPartition. Removed some documentation from Callback.java that stated "except topicPartition" as we are assigning -1 to the topicPartition if it doesn't exist. The changes is based on https://issues.apache.org/jira/browse/KAFKA-3303Committer Checklist (excluded from commit message)